Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Change Rank in Compile

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16046] Change Rank in Compile
  • From: Klamser at t-online.de (Klamser)
  • Date: Sun, 21 Feb 1999 00:15:20 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Can someone tell me please who I can use a bigger array in a compiled
module:

sum$compiled=
  Compile[{{v,_Real,120}},
    Block[{i=1,s=0.0,x=0.0},s=0.0;Do[x=Take[v,i];s=s+x 2,{i,10}]]]

With the Value of 120 I get the message:

Compile::"maxrank": 
    "Rank specification \!\(120\) in \!\({v, _Real, 120}\) exceeds the
rank \
limit (\!\(100\))."

Options[Compile] does not give further information.

The Attributes of Compile are: Attributes[Compile]

{HoldAll,Protected}

And ??Compile tells

"Compile[{x1, x2, ... }, expr] creates a compiled function which
evaluates \
expr assuming numerical values of the xi. Compile[{{x1, t1}, ... },
expr] \
assumes that xi is of a type which matches ti. Compile[{{x1, t1, n1},
... }, \
expr] assumes that xi is a rank ni array of objects each of a type which
\
matches ti. Compile[vars, expr, {{p1, pt1}, ... }] assumes that \
subexpressions in expr which match pi are of types which match pti."

Can I change Rank?

sum$compiled=
  Compile[{{v,_Real,10}},
    Block[{i=1,s=0.0,x=0.0},s=0.0;Do[x=Take[v,i];s=s+x 2,{i,10}]]]

gives the error message

Compile::"cset": 
    "Variable \!\(x\) of type \!\({\"_Real\", 0}\) encountered in
assignment \
of type \!\({\"_Real\", 10}\)."

On this I could not either find a way out.

Yours sincerely Peter Klamser


  • Prev by Date: Re: Re: Bug?
  • Next by Date: Re: Q: Union and SameTest Option
  • Previous by thread: telling DSolve to satisfy boundary conditions?
  • Next by thread: Re: Change Rank in Compile