Greetings,
I have difficulties to speed up my calculation regarding SparseArray:
Date[]
rp = {};
AppendTo[rp, SparseArray[UnitStep[0.01 - dat - dat[[#]]]]] & /@
Range[Length[dat]];
Date[]
dat is a list of Reals containing approx. 24000 elements. I had to use
SparseArray for each line to prevent a memory crash; the final matrix
has 574 million elements. The calculation takes 2' 43'' on my WinXP
Dell workstation (DualCore @ 1.6 GHz, 3 GB RAM)
I would like to speed up the calculation using compile, but the
SparseArray object doesn't fit the tensor format. I have tried:
Compile[{{data, _Real, 1}},
Block[{rp}, rp = {};
AppendTo[rp, SparseArray[UnitStep[0.01 - data - data[[#]]]]] & /@
Range[Length[data]]]]
Compile::cpts: The result after evaluating Insert[rp,SparseArray
[UnitStep[0.01-data-data[[System`Private`CompileSymbol[<<1>>]
[[System`Private`CompileSymbol[<<1>>]]]]]]],-1] should be a tensor.
Nontensor lists are not supported at present; evaluation will proceed
with the uncompiled function. >>
The calculation is used calculate a recurrence plot. The fixed value
of 0.01 will be replaced by a variable later on; therefore, I need to
speed up the calculation.
Any help is appreciated.