Hello,
I have installed Smallapack into Pharo 7.0.3. Thanks Nicholas.
I am very unsure on my use of Smallapack. I am not a mathematician or
scientist. However the only part of Smallapack I am trying to use at the
moment is something that would be 64bit and compare to FloatArray so
that I can do some simple accessing, slicing, sum, and average on the array.
Here is some sample code I wrote just to play in a playground.
I have an ExternalDoubleArray, LapackDGEMatrix, and a FloatArray
samples. The ones not in use are commented out for any run.
fp is a download from
http://ratedata.gaincapital.com/2018/12%20December/EUR_USD_Week1.zipand unzipped to a directory.
fp := '/home/jimmie/data/EUR_USD_Week1.csv'
index := 0.
pricesSum := 0.
asum := 0.
ttr := [
lines := fp asFileReference contents lines allButFirst.
a := ExternalDoubleArray new: lines size.
"la := LapackDGEMatrix allocateNrow: lines size ncol: 1.
a := la columnAt: 1."
"a := FloatArray new: lines size."
lines do: [ :line || parts price |
parts := ',' split: line.
index := index + 1.
price := Float readFrom: (parts last).
a at: index put: price.
pricesSum := pricesSum + price.
(index rem: 100) = 0 ifTrue: [
asum := a sum.
]]] timeToRun.
{ index. pricesSum. asum. ttr }.
"ExternalDoubleArray an Array(337588 383662.5627699992
383562.2956199993 0:00:01:59.885)"
"FloatArray an Array(337588 383662.5627699992 383562.2954441309
0:00:00:06.555)"
FloatArray is not the precision I need. But it is over 18x faster.
I am afraid I must be doing something badly wrong. Python/Numpy is over
4x faster than FloatArray for the above.
If I am using Smallapack incorrectly please help.
Any help greatly appreciated.
Thanks.