math/
sprsadd.pro
top source sprsadd
Math
Adds two sparse matrices (as generated by SPRSIN).
Return value
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.
Parameters
- a in
Sparse matrix to be added.
- b in
Sparse matrix to be added.
Examples
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
Author information
- History:
Written by: Jeremy Bailin, November 2008
File attributes
| Modification date: | Wed Apr 15 16:08:00 2009 |
| Lines: | 82 |
![[attach.png]](../idldoc-resources/attach.png)