Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8126

Problem with compile fct. and Thread

From kristoph <kristophs.post@web.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Problem with compile fct. and Thread
Date 2012-01-24 10:10 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jfm01p$js0$1@smc.vnet.net> (permalink)

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Problem with compile fct. and Thread kristoph <kristophs.post@web.de> - 2012-01-24 10:10 +0000
  Re: Problem with compile fct. and Thread "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2012-01-25 12:10 +0000
    Re: Problem with compile fct. and Thread kris <kristophs.post@web.de> - 2012-01-26 08:32 +0000

csiph-web