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