SPRSADD
Name
SPRSADD
Purpose
Adds two sparse matrices (as generated by SPRSIN).
Category
Math
Calling Sequence
Result = SPRSADD(A,B)
Inputs
A: Sparse matrix to be added.
B: Sparse matrix to be added.
Outputs
The addition of the matrices, in sparse format. This is functionally
equivalent to:
SPRSIN(FULSTR(A) + FULSTR(B))
but can be used even when the full matrices take up too much memory
for that operation.
Example
IDL> a = sprsin([[1,0,0],[0,1,0],[0,0,1]])
IDL> b = sprsin([[0,0,2],[0,2,0],[2,0,0]])
IDL> c = sprsadd(a,b)
IDL> print, fulstr(c)
1.00000 0.00000 2.00000
0.00000 3.00000 0.00000
2.00000 0.00000 1.00000
Modification History
Written by: Jeremy Bailin, November 2008