#
Data Structures and Classes

In this chapter we illustrate the data structures used for definition of routines interfaces. They include data structures for sparse matrices, communication descriptors and preconditioners.

All the data types and the basic subroutine interfaces related to descriptors and sparse matrices are defined in the module `psb_base_mod`; this will have to be included by every user subroutine that makes use of the library. The preconditioners are defined in the module `psb_prec_mod`

Integer, real and complex data types are parametrized with a kind type defined in the library as follows:

psb_spk_
  Kind parameter for short precision real and complex data; corresponds to a `REAL` declaration and is normally 4 bytes;
psb_dpk_
  Kind parameter for long precision real and complex data; corresponds to a `DOUBLE PRECISION` declaration and is normally 8 bytes;
psb_ipk_
  Kind parameter for integer data; with default build options this is a 4 bytes integer, but there is (highly) experimental support for 8-bytes integers;
psb_mpik_
  Kind parameter for 4-bytes integer data, as is always used by MPI;
psb_long_int_k_
  Kind parameter for long (8 bytes) integers, which are always used by the `sizeof` methods.

Together with the classes attributes we also discuss their methods. Most methods detailed here only act on the local variable, i.e. their action is purely local and asynchronous unless otherwise stated. The list of methods here is not completely exhaustive; many methods, especially those that alter the contents of the various objects, are usually not needed by the end-user, and therefore are described in the developer's documentation.

Subsections

- Descriptor data structure
  - Descriptor Methods
  - get_local_rows -- Get number of local rows
  - get_local_cols -- Get number of local cols
  - get_global_rows -- Get number of global rows
  - get_global_cols -- Get number of global cols
  - get_global_indices -- Get vector of global indices
  - get_context -- Get communication context
  - Clone -- clone current object
  - CNV -- convert internal storage format
  - psb_cd_get_large_threshold -- Get threshold for index mapping switch
  - psb_cd_set_large_threshold -- Set threshold for index mapping switch
  - Named Constants
- Sparse Matrix class
  - 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
- Dense Vector Data Structure
  - Vector Methods
  - get_nrows -- Get number of rows in a dense vector
  - sizeof -- Get memory occupation in bytes of a dense vector
  - set -- Set contents of the vector
  - get_vect -- Get a copy of the vector contents
  - clone -- Clone current object
- Preconditioner data structure
- Heap data structure