Re: On the built-in function "Compile"
- To: mathgroup at smc.vnet.net
- Subject: [mg90187] Re: On the built-in function "Compile"
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 2 Jul 2008 05:27:05 -0400 (EDT)
- Organization: Uni Leipzig
- References: <g4d2ui$eqv$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, what shall we help, the compiler can't transfrom it into its own assembler like language, because thare is no low level operation that can do Outer[{#1, #2} &, Range[1, i, 1], Range[1, i, 1]] and we can't change the operations that the Mathematica compiler understand. Regards Jens shingo wrote: > Hi guys, I worked on the mathematica built-in function "Compile" and > found some trobles. If u have some ideas, plz help me. > > Following code works well: > > In[1]:= > testA = Compile[{{i, _Integer}}, # & /@ Range[1, i, 1]] > > Out[1]:= > CompiledFunction[{i},(#1&)/@Range[1,i,1],-CompiledCode-] > > However, in the case of nested list, it doesnt. > > In[2]:= > testB = Compile[{{i, _Integer}}, > Outer[{#1, #2} &, Range[1, i, 1], Range[1, i, 1]]] > > Out[2]:= > Compile::cpapot: Compilation of \ > Outer[{#1,#2}&,Range[1,i,1],Range[1,i,1]] is not supported for the \ > function argument {#1,#2}&. The only function arguments supported are > \ > Times, Plus, or List. Evaluation will use the uncompiled function. >> > CompiledFunction[{i},Outer[{#1,#2}&,Range[1,i,1],Range[1,i,1]],- > CompiledCode-] > > Thanks in advance :) > > shingo >