The SPRSAB function performs matrix multiplication on two row-indexed sparse arrays created by SPRSIN. The routine computes all components of the matrix products, but only stores those values whose absolute magnitude exceeds the threshold value. The result is a row-indexed sparse array.
SPRSAB is based on the routine
sprstm
described in section 2.7 of
Numerical Recipes in C: The Art of Scientific Computing
(Second Edition), published by Cambridge University Press, and is used by permission. The difference between the two routines is that SPRSAB performs the matrix multiplication A.B rather than A.B
T
.
sparse = SPRSAB(SPRSIN(A), SPRSIN(B)) ; Convert the arrays to sparse array format before multiplying. The variable SPARSE holds the result in sparse array form.
result = FULSTR(sparse) ; Restore the sparse array structure to full storage mode.
PRINT, result ; Print the result.
5.00000 13.0000 18.0000 6.00000
-3.00000 15.0000 12.0000 2.00000
1.00000 17.0000 18.0000 5.00000
6.00000 3.00000 6.00000 10.0000
We can check this result by multiplying the original arrays:
5.00000 13.0000 18.0000 6.00000
-3.00000 15.0000 12.0000 2.00000