[squeak-dev] Smallapack issue, may be FFI?

Yoshiki Ohshima Yoshiki.Ohshima at acm.org
Sun Jan 22 16:52:13 UTC 2017

Hello Nico and all,

I came back to trying to use Smallapack, and found an interesting
problem of getting different results.

Let us say the following code:

random := Random new.
i := 40.
data := (1 to: i) collect: [:j | FloatArray new: i].
1 to: i do: [:y |
	1 to: i do: [:x |
		(data at: y) at: x put: random next * 10.0.]].
a := LapackSGEMatrix rows: data.

This creates a 40x40 matrix with some numbers in it; it uses Random
here but the values in 'a' are fixed below.  Then evaluate:

((1 to: 100) collect: [:i | a reciprocal]) asSet size

To compute reciprocal of the same 'a' 100 times.  So I expect the
value from the 'asSet size' to be one, as it should always compute the
same value.

However, I get variations in the result.  some times the result is 4,
sometimes 2, etc. When the size of matrix is 100x100 or such, the
number of variations become even bigger.

This happens on the recent VMs and the latest lapack.

I don't have a good guess where the error could be?  As far as I can
tell, the algorithm Lapack is deterministic.  As it happens when the
matrix is large, I could suspect that some boundary is crossed
ExternalArray creation or such.

I am also curious if this is reproducible on other environments.  This
happens on Mac OS.  The dylabs I use are coypied from the system

-- Yoshiki

More information about the Squeak-dev mailing list