Documentation for module dbcsr_util

DBCSR sparse matrix utility routines

source: dbcsr_util.F
Loading...

public Subroutines/Functions:

Converts offsets to sizes
Converts sizes to offsets
SUBROUTINE PURE
count_bins (nelements, bins, nbins, bin_counts)
...
Calculates explicit sizes for all data blocks.
FUNCTION
REAL(dp)
dbcsr_checksum (matrix, local, pos)
Calculates the checksum of a DBCSR matrix.
Copies metadata into an array.
Sets metadata form an array.
Verify the correctness of a BCSR matrix.
Finds block to which a full element belongs.
Finds internal offsets
Converts global offsets to local
Makes a lookup table from the most common elements.
Fills meta information from a given distribution_2d
FUNCTION
INTEGER PURE
nfull_elements (all_offsets, local_elements)
The sum of a subset of rows/columns
FUNCTION
INTEGER ELEMENTAL
sgn (n, oldsign, x)
...

PURE SUBROUTINEconvert_offsets_to_sizes(offsets_start, sizes, offsets_stop)

Converts offsets to sizes

Arguments:
INTEGER,
INTENT(in)
:: offsets_start(:) offsets of starts
INTEGER,
INTENT(out)
:: sizes(:) array with sizes
INTEGER,
INTENT(in),
OPTIONAL
:: offsets_stop(:) offsets of ends

PURE SUBROUTINEconvert_sizes_to_offsets(sizes, offsets_start, offsets_stop)

Converts sizes to offsets

Arguments:
INTEGER,
INTENT(in)
:: sizes(:) array with sizes
INTEGER,
INTENT(out)
:: offsets_start(:) offsets of starts
INTEGER,
INTENT(out),
OPTIONAL
:: offsets_stop(:) offsets of ends

PURE SUBROUTINEcount_bins(nelements, bins, nbins, bin_counts)

...

Arguments:
INTEGER,
INTENT(in)
:: nelements ...
INTEGER,
INTENT(in)
:: bins(1:nelements) ...
INTEGER,
INTENT(in)
:: nbins ...
INTEGER,
INTENT(out)
:: bin_counts(1:nbins) ...

SUBROUTINEdbcsr_calc_block_sizes(sizes, row_p, col_i, rbs, cbs)

Calculates explicit sizes for all data blocks.

Arguments:
INTEGER,
INTENT(out)
:: sizes(*) sizes of all data blocks
INTEGER,
INTENT(in)
:: row_p(:) index structure
INTEGER,
INTENT(in)
:: col_i(*) index structure
INTEGER,
INTENT(in)
:: rbs(*) row block sizes
INTEGER,
INTENT(in)
:: cbs(*) column block sizes

FUNCTIONdbcsr_checksum(matrix, local, pos)

Calculates the checksum of a DBCSR matrix.

Return Value ::
REAL(dp)
calculated checksum
Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: matrix matrix
LOGICAL,
INTENT(in),
OPTIONAL
:: local no global communication
LOGICAL,
INTENT(in),
OPTIONAL
:: pos position-dependent checksum

SUBROUTINEdbcsr_pack_meta(matrix, meta)

Copies metadata into an array.

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: matrix Matrix
INTEGER,
INTENT(out)
:: meta(dbcsr_meta_size) Metadata elements

SUBROUTINEdbcsr_unpack_meta(matrix, meta)

Sets metadata form an array.

Arguments:
TYPE(dbcsr_type),
INTENT(inout)
:: matrix Matrix
INTEGER,
INTENT(in)
:: meta(dbcsr_meta_size) Metadata elements

SUBROUTINEdbcsr_verify_matrix(m, verbosity, local)

Verify the correctness of a BCSR matrix.

Arguments:
TYPE(dbcsr_type),
INTENT(in)
:: m bcsr matrix
INTEGER,
INTENT(in),
OPTIONAL
:: verbosity how detailed errors are; 0=nothing; 1=summary at end if matrix not consistent; 2=also individual errors; 3=always print info about matrix; >3=even more info
LOGICAL,
INTENT(in),
OPTIONAL
:: local no global communication

SUBROUTINEfind_block_of_element(full, block, nblocks, block_offsets, hint)

Finds block to which a full element belongs.

Arguments:
INTEGER,
INTENT(in)
:: full full element
INTEGER,
INTENT(out)
:: block block to which full belongs
INTEGER,
INTENT(in)
:: nblocks ...
INTEGER,
INTENT(in)
:: block_offsets(1:nblocks+1) starting full elements of blocks
INTEGER,
INTENT(in)
:: hint where to start looking; ignored if 0

SUBROUTINEget_internal_offsets(blk_local_els, el_map, blk_el_offsets, dense_el_offsets, internal_offsets)

Finds internal offsets

Arguments:
INTEGER,
INTENT(in)
:: blk_local_els(:) ...
INTEGER,
INTENT(in)
:: el_map(:) ...
INTEGER,
INTENT(in)
:: blk_el_offsets(:) ...
INTEGER,
INTENT(in)
:: dense_el_offsets(:) ...
INTEGER,
INTENT(out)
:: internal_offsets(:) ...

SUBROUTINEglobal_offsets_to_local(global_offsets, local_elements, local_offsets)

Converts global offsets to local

Arguments:
INTEGER,
INTENT(in)
:: global_offsets(:) Offsets of elements in the global grid
INTEGER,
INTENT(in)
:: local_elements(:) Which elements are local
INTEGER,
INTENT(out)
:: local_offsets(:) Offsets of local elements.

SUBROUTINEmap_most_common(array, most_common_map, nmost_common, most_common_elements, size_limit, max_val)

Makes a lookup table from the most common elements.

Arguments:
INTEGER,
INTENT(in)
:: array(:) Array for which to find the most common elements.
INTEGER(int_4),
POINTER
:: most_common_map(:) Ranking of the most common elements in array
INTEGER,
INTENT(in)
:: nmost_common The number of most common elements
INTEGER,
INTENT(out)
:: most_common_elements(:) The most common elements in array
INTEGER,
INTENT(in)
:: size_limit Limit maximum size to this value
INTEGER,
INTENT(out)
:: max_val ...

SUBROUTINEmeta_from_dist(meta, dist, row_blk_size, col_blk_size)

Fills meta information from a given distribution_2d

Arguments:
INTEGER,
INTENT(out)
:: meta(dbcsr_meta_size) meta information array to fill
INTENT(in)
:: dist processor distribution
INTEGER,
INTENT(in),
POINTER
:: row_blk_size(:) row block sizes
INTEGER,
INTENT(in),
POINTER
:: col_blk_size(:) column block sizes

PURE FUNCTIONnfull_elements(all_offsets, local_elements)

The sum of a subset of rows/columns

Return Value ::
INTEGER
sum of sizes of local elemetns
Arguments:
INTEGER,
INTENT(in)
:: all_offsets(:) ordered offsets of all the elements
INTEGER,
INTENT(in)
:: local_elements(:) enumerated local elements

ELEMENTAL FUNCTIONsgn(n, oldsign, x)

...

Return Value ::
INTEGER
Arguments:
INTEGER,
INTENT(in)
:: n ...
INTEGER,
INTENT(in)
:: oldsign ...
LOGICAL,
INTENT(in)
:: x ...