SPRSAX

The SPRSAX function takes a row-indexed sparse array created by the SPRSIN function and multiplies it by an n -element vector to its right. The result is a n -element vector.

SPRSAX is based on the routine sprsax 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.

Calling Sequence

Result = SPRSAX( A, X )

Arguments

A

A row-indexed sparse array created by the SPRSIN function.

X

An n -element right hand vector.

Keywords

DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

Example

Begin by creating an array A:

A = [[ 5.0, 0.0, 0.0], $

     [ 3.0, -2.0, 0.0], $

     [ 4.0, -1.0, 0.0]]

X = [1.0, 2.0, -1.0] ; Define the right-hand vector.

result = SPRSAX(SPRSIN(A),X) ; Convert to sparse format, then multiply by X.

PRINT, result ; Print the result.

IDL prints:

5.00000 -1.00000 2.00000

See Also

FULSTR , LINBCG , SPRSAB , SPRSIN , READ_SPR , WRITE_SPR