Re: Compiled PDF & CDF Issues
- To: mathgroup at smc.vnet.net
- Subject: [mg90604] Re: Compiled PDF & CDF Issues
- From: dh <dh at metrohm.ch>
- Date: Tue, 15 Jul 2008 06:18:50 -0400 (EDT)
- References: <g5f60t$rdb$1@smc.vnet.net>
Hi Benedetto, the manual states that the only data types Compile can handle are: Integer Real,Complex and Boolean. However, HypergeometricDistribution returns a distribution and CDF a function. hope this helps, Daniel Benedetto Bongiorno wrote: > Members, > > > > Below listed is my notebook "HypergeometricDistributionErrors.nb" that shows > the following: > > When I use the PDF or CDF functions I get the correct answers. > > When I use the compiled PDF or CDF functions I get the correct answers but > CompiledFunction::cfse errors. > > > > I cannot figure what I am doing wrong. > > > > Mathematica V 6.0.3 > > OS Microsoft Windows XP Professional x64 > > > > I thank you ahead for you advice. > > > > > > Ben Bongiorno > > > > Notebook start****************************************** > > Table[{k,CDF[HypergeometricDistribution[5,12,20],k]},{k,0,5}] > > {{0,7/1938},{1,56/969},{2,287/969},{3,224/323},{4,613/646},{5,1}} > > > > Compile[{sample,populationMarked,population,xMin,xMax}, > > > Table[{k,CDF[HypergeometricDistribution[sample,populationMarked,population], > k]},{k,xMin,xMax}]]; > > %[5,12,20,0,5] > > CompiledFunction::cfse: Compiled expression > HypergeometricDistribution[5.,12.,20.] should be a machine-size real number. > > > CompiledFunction::cfex: Could not complete external evaluation at > instruction 13; proceeding with uncompiled evaluation. > > {{0,7/1938},{1,56/969},{2,287/969},{3,224/323},{4,613/646},{5,1}} > > > > > > Table[{k,PDF[HypergeometricDistribution[5,12,20],k]},{k,0,5}] > > {{0,7/1938},{1,35/646},{2,77/323},{3,385/969},{4,165/646},{5,33/646}} > > Compile[{sample,populationMarked,population,xMin,xMax},Table[{k,PDF[Hypergeo > metricDistribution[sample,populationMarked,population],k]},{k,xMin,xMax}]]; > > %[5,12,20,0,5] > > CompiledFunction::cfse: Compiled expression > HypergeometricDistribution[5.,12.,20.] should be a machine-size real number. > > > CompiledFunction::cfex: Could not complete external evaluation at > instruction 13; proceeding with uncompiled evaluation. > > {{0,7/1938},{1,35/646},{2,77/323},{3,385/969},{4,165/646},{5,33/646}} > > Notebook end********************************************************* > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail:<mailto:dh at metrohm.com> Internet:<http://www.metrohm.com>