This subroutine converts either m by n general sparse matrix A or symmetric sparse matrix A of order n from storage-by-rows to compressed-matrix storage mode, where matrix A contains long-precision real numbers.
| Fortran | CALL DSRSM (iopt, ar, ja, ia, m, nz, ac, ka, lda) |
| C and C++ | dsrsm (iopt, ar, ja, ia, m, nz, ac, ka, lda); |
| PL/I | CALL DSRSM (iopt, ar, ja, ia, m, nz, ac, ka, lda); |
If iopt = 0, matrix A is a general sparse matrix, where all the nonzero elements in matrix A are used to set up the storage arrays.
If iopt = 1, matrix A is a symmetric sparse matrix, where only the upper triangle and diagonal elements are used to set up the storage arrays.
Specified as: a fullword integer; iopt = 0 or 1.
A sparse matrix A is converted from storage-by-rows (using arrays AR, JA, and IA) to compressed-matrix storage mode (using arrays AC and KA). The argument iopt indicates whether the input matrix A is stored by rows using the storage variation for general sparse matrices or for symmetric sparse matrices. See reference [73].
This subroutine is meant for existing programs that need to convert their sparse matrices to a storage mode compatible with some of the ESSL sparse matrix subroutines, such as DSMMX.
None
This example shows a general sparse matrix A, which is stored by rows and converted to compressed-matrix storage mode, where sparse matrix A is:
* *
| 11.0 0.0 0.0 14.0 |
| 0.0 22.0 0.0 24.0 |
| 0.0 0.0 33.0 34.0 |
| 0.0 0.0 0.0 44.0 |
* *
Because there is a maximum of only two nonzero elements in each row of A, and argument nz is specified as 5, columns 3 through 5 of arrays AC and KA are not used.
IOPT AR JA IA M NZ AC KA LDA
| | | | | | | | |
CALL DSRSM( 0 , AR , JA , IA , 4 , 5 , AC , KA , 4 )
AR = (11.0, 14.0, 22.0, 24.0, 33.0, 34.0, 44.0)
JA = (1, 4, 2, 4, 3, 4, 4)
IA = (1, 3, 5, 7, 8)
NZ = 2
* *
| 11.0 14.0 . . . |
AC = | 22.0 24.0 . . . |
| 33.0 34.0 . . . |
| 44.0 0.0 . . . |
* *
* *
| 1 4 . . . |
KA = | 2 4 . . . |
| 3 4 . . . |
| 4 4 . . . |
* *
This example shows a symmetric sparse matrix A, which is stored by rows and converted to compressed-matrix storage mode, where sparse matrix A is:
* *
| 11.0 0.0 0.0 14.0 |
| 0.0 22.0 0.0 24.0 |
| 0.0 0.0 33.0 34.0 |
| 14.0 24.0 34.0 44.0 |
* *
Because there is a maximum of only four nonzero elements in each row of A, and argument nz is specified as 6, columns 5 and 6 of arrays AC and KA are not used.
IOPT AR JA IA M NZ AC KA LDA
| | | | | | | | |
CALL DSRSM( 1 , AR , JA , IA , 4 , 6 , AC , KA , 4 )
AR = (11.0, 14.0, 22.0, 24.0, 33.0, 34.0, 44.0)
JA = (1, 4, 2, 4, 3, 4, 4)
IA = (1, 3, 5, 7, 8)
NZ = 4
* *
| 11.0 14.0 0.0 0.0 . . |
AC = | 22.0 24.0 0.0 0.0 . . |
| 33.0 34.0 0.0 0.0 . . |
| 44.0 24.0 34.0 14.0 . . |
* *
* *
| 1 4 4 4 . . |
KA = | 2 4 4 4 . . |
| 3 4 4 4 . . |
| 4 2 3 1 . . |
* *