# Data Structures
Keywords: userhtml

Next: Descriptor data structure Up: userhtml Previous: Programming model Contents

#
Data Structures

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 are defined in the module `psb_base_mod`; this will have to be included by every user subroutine that makes use of the library.

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.

Moreover, the library defines a long integer kind `psb_long_int_k_` which normally corresponds to 64-bit integers; it is only used for the `psb_sizeof` utility.

Subsections

- Descriptor data structure
  - Named Constants
- Sparse Matrix data structure
  - Named Constants
- Preconditioner data structure
- Data structure query routines
  - psb_cd_get_local_rows -- Get number of local rows
  - psb_cd_get_local_cols -- Get number of local cols
  - psb_cd_get_global_rows -- Get number of global rows
  - psb_cd_get_global_cols -- Get number of global cols
- psb_cd_get_context--Get communication context
  - psb_cd_get_large_threshold -- Get threshold for index mapping switch
  - psb_cd_set_large_threshold -- Set threshold for index mapping switch
  - psb_sp_get_nrows -- Get number of rows in a sparse matrix
  - psb_sp_get_ncols -- Get number of columns in a sparse matrix
  - psb_sp_get_nnzeros -- Get number of nonzero elements in a sparse matrix