3 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_mpk_
Kind parameter for 4-bytes integer data, as is always used by MPI;
psb_epk_
Kind parameter for 8-bytes integer data, as is always used by the sizeof methods;
psb_ipk_
Kind parameter for “local” integer indices and data; with default build options this is a 4 bytes integer;
psb_lpk_
Kind parameter for “global” integer indices and data; with default build options this is an 8 bytes integer;

The integer kinds for local and global indices can be chosen at configure time to hold 4 or 8 bytes, with the global indices at least as large as the local ones. 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.

 3.1 Descriptor data structure
  3.1.1 Descriptor Methods
  3.1.2 get_local_rows — Get number of local rows
  3.1.3 get_local_cols — Get number of local cols
  3.1.4 get_global_rows — Get number of global rows
  3.1.5 get_global_cols — Get number of global cols
  3.1.6 get_global_indices — Get vector of global indices
  3.1.7 get_context — Get communication context
  3.1.8 Clone — clone current object
  3.1.9 CNV — convert internal storage format
  3.1.10 psb_cd_get_large_threshold — Get threshold for index mapping switch
  3.1.11 psb_cd_set_large_threshold — Set threshold for index mapping switch
  3.1.12 get_p_adjcncy — Get process adjacency list
  3.1.13 set_p_adjcncy — Set process adjacency list
  3.1.14 fnd_owner — Find the owner process of a set of indices
  3.1.15 Named Constants
 3.2 Sparse Matrix class
  3.2.1 Sparse Matrix Methods
  3.2.2 get_nrows — Get number of rows in a sparse matrix
  3.2.3 get_ncols — Get number of columns in a sparse matrix
  3.2.4 get_nnzeros — Get number of nonzero elements in a sparse matrix
  3.2.5 get_size — Get maximum number of nonzero elements in a sparse matrix
  3.2.6 sizeof — Get memory occupation in bytes of a sparse matrix
  3.2.7 get_fmt — Short description of the dynamic type
  3.2.8 is_bld, is_upd, is_asb — Status check
  3.2.9 is_lower, is_upper, is_triangle, is_unit — Format check
  3.2.10 cscnv — Convert to a different storage format
  3.2.11 csclip — Reduce to a submatrix
  3.2.12 clean_zeros — Eliminate zero coefficients
  3.2.13 get_diag — Get main diagonal
  3.2.14 clip_diag — Cut out main diagonal
  3.2.15 tril — Return the lower triangle
  3.2.16 triu — Return the upper triangle
  3.2.17 psb_set_mat_default — Set default storage format
  3.2.18 clone — Clone current object
  3.2.19 Named Constants
 3.3 Dense Vector Data Structure
  3.3.1 Vector Methods
  3.3.2 get_nrows — Get number of rows in a dense vector
  3.3.3 sizeof — Get memory occupation in bytes of a dense vector
  3.3.4 set — Set contents of the vector
  3.3.5 get_vect — Get a copy of the vector contents
  3.3.6 clone — Clone current object
 3.4 Preconditioner data structure
 3.5 Heap data structure