MathGroup Archive 1999

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

Search the Archive

Compile problem: Mathematica 4


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