Re: On the built-in function "Compile"
- To: mathgroup at smc.vnet.net
- Subject: [mg90208] Re: On the built-in function "Compile"
- From: "Guy Lamouche" <noemail at noemail.com>
- Date: Wed, 2 Jul 2008 05:31:04 -0400 (EDT)
- References: <g4d2ui$eqv$1@smc.vnet.net>
Hi, it looks like you have the answer in the error message (use List): testB = Compile[{{i, _Integer}}, Outer[List, Range[1, i, 1], Range[1, i, 1]]] Why do you use Compile on this? It looks like since you are working with integers it does not bring any increase in processing speed. Guy Lamouche "shingo" <shingo.yoshimura at gmail.com> wrote in message news:g4d2ui$eqv$1 at smc.vnet.net... > 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 >