Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

On the built-in function "Compile"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90175] On the built-in function "Compile"
  • From: shingo <shingo.yoshimura at gmail.com>
  • Date: Tue, 1 Jul 2008 07:01:15 -0400 (EDT)

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


  • Prev by Date: Re: Re: Subscript Bug?
  • Next by Date: Re: How to plot discontinuous functions?
  • Previous by thread: Re: A set of several questions
  • Next by thread: Re: On the built-in function "Compile"