[Pharo-dev] FloatArray

Jimmie jlhouchin at gmail.com
Sun May 19 08:57:50 EDT 2019

On 5/16/19 1:26 PM, Nicolas Cellier wrote:> Any feedback on this?
 > Did someone tried to use Smallapack in Pharo?
 > Jimmie?

I am going to guess that you are not on pharo-users. My bad.
I posted this in pharo-users as I it wasn't Pharo development question.

I probably should have posted here or emailed you directly.

All I really need is good performance with a simple array of floats. No 
matrix math. Nothing complicated. Moving Averages over a slice of the 
array. A variety of different averages, weighted, etc. Max/min of the 
array. But just a single simple array.

Any help greatly appreciated.


On 4/28/19 8:32 PM, Jimmie Houchin wrote:

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 
and 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 

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.


More information about the Pharo-dev mailing list