MathGroup Archive 1999

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

Search the Archive

Compile problem: Mathematica 4

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18777] Compile problem: Mathematica 4
  • From: "Paul Howland" <paul.howland at nc3a.nato.int>
  • Date: Tue, 20 Jul 1999 01:33:32 -0400
  • Organization: NATO C3 Agency
  • Sender: owner-wri-mathgroup at wolfram.com

Hi.

What is wrong with the following (simplified) compile statement?  It seems
that the Compiler doesn't recognise that Round[] returns an object with a
Head of Integer.  Can I explicitly tell the compiler that this is the case?

Thanks for help/comments in advance.

Paul


Code follows:

In[4]:=
f=Compile[{{x, _Real,1}}, i=Round[2.3]; x[[i]]++;Return[x]]

Compile::cpintlt:
    i at position 2 of x[[i]] should be either a non-zero integer or a
vector of \
    non-zero integers; evaluation will use the uncompiled function."

Out[4]=
CompiledFunction[{x},i=Round[2.3]; x[[i]]++;Return[x], -CompiledCode-]


In[5]:=
Round[2.3] //Head

Out[5]=
Integer




  • Prev by Date: ValueBoxes
  • Next by Date: Re(2): Re(2): RE: ExpIntegralEi
  • Previous by thread: Re: ValueBoxes
  • Next by thread: Re: Compile problem: Mathematica 4