#include <AbstractLinAlgPack_MatrixConvertToSparse.hpp>
Inheritance diagram for AbstractLinAlgPack::MatrixConvertToSparse:
Public Types | |
| enum | EExtractRegion { EXTRACT_FULL_MATRIX, EXTRACT_UPPER_TRIANGULAR, EXTRACT_LOWER_TRIANGULAR } |
| More... | |
| enum | EElementUniqueness { ELEMENTS_FORCE_UNIQUE, ELEMENTS_ALLOW_DUPLICATES_SUM } |
| More... | |
Public Member Functions | |
| virtual index_type | num_nonzeros (EExtractRegion extract_region, EElementUniqueness element_uniqueness) const =0 |
| Returns the number of nonzeros in the matrix. | |
| virtual void | coor_extract_nonzeros (EExtractRegion extract_region, EElementUniqueness element_uniqueness, const index_type len_Aval, value_type Aval[], const index_type len_Aij, index_type Arow[], index_type Acol[], const index_type row_offset=0, const index_type col_offset=0) const =0 |
| Extract sparse elements in a coordinate data structure. | |
The formats supported are:
Coordiante:
Aval[k], Arow[k], Acol[k], k = 0..num_nonzeros(...)-1
Aval[k], Acol[k], k = 0..num_nonzeros(...)-1
Arow_start[j], j = 0..rows()-1
The following matrix is used in the documentation for the following extraction functions.
[ 1.1 1.3 1.4 ] 1
[ 2.2 2.4 ] 2
A = [ 3.2 ] 3
[ 4.1 4.3 4.4 ] 4
[ 5.1 5.3 5.4 ] 5
1 2 3 4
Note that above, A has:
A_nz == this->num_nonzeros(EXTRACT_FULL_MATRIX,ELEMENTS_FORCE_UNIQUE) == 12 A_up_nz = this->num_nonzeros(EXTRACT_UPPER_TRIANGULAR,ELEMENTS_FORCE_UNIQUE) == 6 A_lo_nz = this->num_nonzeros(EXTRACT_LOWER_TRIANGULAR,ELEMENTS_FORCE_UNIQUE) == 9
Definition at line 75 of file AbstractLinAlgPack_MatrixConvertToSparse.hpp.
|
|
Definition at line 81 of file AbstractLinAlgPack_MatrixConvertToSparse.hpp. |
|
|
Definition at line 87 of file AbstractLinAlgPack_MatrixConvertToSparse.hpp. |
|
||||||||||||
|
Returns the number of nonzeros in the matrix.
Implemented in AbstractLinAlgPack::MatrixConvertToSparseEncap, AbstractLinAlgPack::MatrixExtractSparseElements, and AbstractLinAlgPack::MatrixSymDiagSparse. |
|
||||||||||||||||||||||||||||||||||||||||
|
Extract sparse elements in a coordinate data structure.
The client can extract the structure in
The client can choose to extract the nonzeros for the full matrix (
The client can force the extracted nonzero elements to have unique row and column indexes (
To illustrate the behavior of this function consider the example matix (1) To extract all of the nonzero elements and structure for the full matrix with the row and column indexes offset by 2 and 4 respectively the following input would yield the following output. Input:
extract_region = EXTRACT_FULL_MATRIX
element_uniqueness = ELEMENTS_FORCE_UNIQUE
len_Aval = A_nz = 12
len_Aij = A_nz = 12
row_offset = 2
col_offset = 4
k Aval[k-1] Arow[k-1] Acol[k-1]
- --------- --------- ---------
1 1.1 3 5
2 4.1 5 5
3 5.1 7 5
4 2.2 4 6
5 3.2 5 6
6 1.3 3 7
7 4.3 6 7
8 5.3 7 7
9 1.4 3 8
10 2.4 4 8
11 4.4 6 8
12 5.4 7 8
(2) To extract all of the nonzero elements and structure for the upper triangular region of the matrix with the row and column indexes offset by 0 and 0 respectively the following input would yield the following output. Input:
extract_region = EXTRACT_UPPER_TRIANGULAR
element_uniqueness = ELEMENTS_FORCE_UNIQUE
len_Aval = A_up_nz = 6
len_Aij = A_up_nz = 6
row_offset = 0
col_offset = 0
k Aval[k-1] Arow[k-1] Acol[k-1]
- --------- --------- ---------
1 1.1 1 1
2 2.2 2 2
3 1.3 1 3
4 1.4 1 4
5 2.4 2 4
6 4.4 4 4
(3) To extract all of the nonzero elements and structure for the lower triangular region of the matrix with the row and column indexes offset by 0 and 0 respectively the following input would yield the following output. Input:
extract_region = EXTRACT_LOWER_TRIANGULAR
element_uniqueness = ELEMENTS_FORCE_UNIQUE
len_Aval = A_lo_nz = 9
len_Aij = A_lo_nz = 9
row_offset = 0
col_offset = 0
k Aval[k-1] Arow[k-1] Acol[k-1]
- --------- --------- ---------
1 1.1 1 1
2 4.1 4 1
3 5.1 5 1
4 2.2 2 2
5 3.2 3 2
6 4.3 4 3
7 5.3 5 3
8 4.4 4 4
9 5.4 5 4
Implemented in AbstractLinAlgPack::MatrixConvertToSparseEncap, AbstractLinAlgPack::MatrixExtractSparseElements, and AbstractLinAlgPack::MatrixSymDiagSparse. |
1.3.9.1