Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Compiled function not working

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110445] Compiled function not working
  • From: Fred Bartoli <myname_with_a_dot_inbetween at free.fr>
  • Date: Fri, 18 Jun 2010 07:44:12 -0400 (EDT)
  • Reply-to: myname_with_a_dot_inbetween at free.fr

Hello,

I've a function that I need compiled for better performances.

ZsNoR[n_]=(3 4^(1+n))/(2+4^(1+n))

cf=Compile[{{code,_Integer},{nb,_Integer}},Module[{SwList=Reverse@IntegerDigits[code,2,nb]},\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 0\), \(nb - 1\)]
\*FractionBox[\(1\), \(ZsNoR[Part[SwList, i + 1]]\)]\)]]


cf[128,8]

But when I evaluate cf I get a
"CompiledFunction::cfse: Compiled expression 8/3 should be a 
machine-size integer"  error message that make no sense to me.

What am I doing wrong?


-- 
Thanks,
Fred.


  • Prev by Date: Named patterns forbidden in Except?
  • Next by Date: Re: Simplifying complicated expressions
  • Previous by thread: Re: Named patterns forbidden in Except?
  • Next by thread: Re: Compiled function not working