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

MathGroup Archive 2012

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

Search the Archive

Problem with compile fct. and Thread

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124549] Problem with compile fct. and Thread
  • From: kristoph <kristophs.post at web.de>
  • Date: Tue, 24 Jan 2012 05:08:07 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hi

I get an error when trying to compute the following "toy" code:

(*the compile function*)
test=Compile[{{bw,_Real},{regData,_Real,1},{leg,_Integer}},
Module[{h,tab2,xMat},
h=1;
tab2=Table[(regData[[i]]-regData[[j]]),{i,1,leg},{j,1,leg}];
xMat=Thread[{1.,tab2[[h]]}]
]
,CompilationOptions->{"InlineExternalDefinitions"->True}];

(*generating random sample data*)
leg=100;
data=RandomReal[{0,1},leg];
bw=.1;

(*using the compile function with the above generated data, produces
the error*)
test[bw, data, leg]

The function "test" works fine if I construct the matrix "xMat" using
the function Table. However, I prefer Thread because it is twice as
fast.

I just do not see where my mistake is. I do appreciate any
suggestions. Thanks in advance.
Cheers,
Kris



  • Prev by Date: How to look for this kind of error
  • Next by Date: Plotting in nested Manipulates
  • Previous by thread: Re: How to look for this kind of error
  • Next by thread: Re: Problem with compile fct. and Thread