Next: Sparse Matrix Methods Up: Data Structures and Classes Previous: Named Constants Contents

##
Sparse Matrix class

The spdata`psb_Tspmat_type` class contains all information about the local portion of the sparse matrix and its storage mode. Its design is based on the STATE design pattern [13] as detailed in [11]; the type declaration is shown in figure 4 where `T` is a placeholder for the data type and precision variants

S
  Single precision real;
D
  Double precision real;
C
  Single precision complex;
Z
  Double precision complex.

The actual data is contained in the polymorphic component `a%a` of type spbasedata`psb_T_base_sparse_mat`; its specific layout can be chosen dynamically among the predefined types, or an entirely new storage layout can be implemented and passed to the library at runtime via the `psb_spasb` routine.

Figure 4: The PSBLAS defined data type that contains a sparse matrix.
      type :: psb_Tspmat_type
        class(psb_T_base_sparse_mat), allocatable  :: a
      end type  psb_Tspmat_type

The following very common formats are precompiled in PSBLAS and thus are always available:

psb_T_coo_sparse_mat
  Coordinate storage;
psb_T_csr_sparse_mat
  Compressed storage by rows;
psb_T_csc_sparse_mat
  Compressed storage by columns;

The inner sparse matrix has an associated state, which can take the following values:

Build:
  State entered after the first allocation, and before the first assembly; in this state it is possible to add nonzero entries.
Assembled:
  State entered after the assembly; computations using the sparse matrix, such as matrix-vector products, are only possible in this state;
Update:
  State entered after a reinitalization; this is used to handle applications in which the same sparsity pattern is used multiple times with different coefficients. In this state it is only possible to enter coefficients for already existing nonzero entries.

The only storage variant supporting the build state is COO; all other variants are obtained by conversion to/from it.

Subsections

- Sparse Matrix Methods
- get_nrows -- Get number of rows in a sparse matrix
- get_ncols -- Get number of columns in a sparse matrix
- get_nnzeros -- Get number of nonzero elements in a sparse matrix
- get_size -- Get maximum number of nonzero elements in a sparse matrix
- sizeof -- Get memory occupation in bytes of a sparse matrix
- get_fmt -- Short description of the dynamic type
- is_bld, is_upd, is_asb -- Status check
- is_lower, is_upper, is_triangle, is_unit -- Format check
- cscnv -- Convert to a different storage format
- csclip -- Reduce to a submatrix
- clean_zeros -- Eliminate zero coefficients
- get_diag -- Get main diagonal
- clip_diag -- Cut out main diagonal
- tril -- Return the lower triangle
- triu -- Return the upper triangle
- psb_set_mat_default -- Set default storage format
- clone -- Clone current object
- Named Constants

Next: Sparse Matrix Methods Up: Data Structures and Classes Previous: Named Constants Contents