CONGEN
5.0
Configuration generation for SCATCI
|
Determinant binary search tree. More...
Data Types | |
type | det_tree |
Determinant binary search tree. More... | |
Functions/Subroutines | |
subroutine | init_det_tree (this, ndo, nelt) |
Initialize determinant tree. More... | |
subroutine | final_det_tree (this) |
Finalize determinant tree. More... | |
integer function | locate_in_det_tree (this, det) |
Find a specific determinant in the storage. More... | |
subroutine | write_determinant (this, lu, id) |
Write determinat. More... | |
integer function | compare_determinats (this, i, j, data) |
Lexicographically compare two determinats. More... | |
This module contains a special data structure, det_tree, used (e.g.) by CONGEN to carry out quick look-ups in the storage of determinants. It is based on the type "bstree" from libAMOR.
integer function congen_bstree::compare_determinats | ( | class(det_tree), intent(in) | this, |
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
type(c_ptr), intent(in), optional | data | ||
) |
Binary tree needs a notion of order of its elements to be able to work with the data so efficiently. In case of arrays of numbers, the typical order is the "lexicographical" order. The array A is less than B if for the first position I for which A(I) /= B(I) holds that A(I) < B(I).
If any of the given indices is negative, the reference determinant stored within the predicate type is used instead.
this | Determinant tree object to use |
i | Index of the first determinant |
j | Index of the second determinant |
data | Additional payload required by base class interface. Not used in congen. |
Definition at line 172 of file congen_bstree.f90.
subroutine congen_bstree::final_det_tree | ( | type(det_tree), intent(inout) | this | ) |
Releases all allocated memory.
this | Tree object to finalize |
Definition at line 90 of file congen_bstree.f90.
Referenced by congen_bstree::det_tree::final_det_tree().
subroutine congen_bstree::init_det_tree | ( | class(det_tree), intent(inout) | this, |
integer, dimension(:), intent(in), pointer | ndo, | ||
integer, intent(in) | nelt | ||
) |
Stores pointer to the determinant storage, so that it can be used when comparing determinant indices in the binary search tree subroutines.
this | Tree object to initialize |
ndo | Determinant storage |
nelt | Size of a determinant |
Definition at line 68 of file congen_bstree.f90.
integer function congen_bstree::locate_in_det_tree | ( | class(det_tree), intent(inout) | this, |
integer, dimension(this % nelt), intent(in) | det | ||
) |
Return index in the determinant storage, where the given determinant is located. Return -1 when there is no such determinant.
this | Tree object to search |
det | Determinant to find (length nelt) |
Definition at line 111 of file congen_bstree.f90.
subroutine congen_bstree::write_determinant | ( | class(det_tree), intent(in) | this, |
integer, intent(in) | lu, | ||
integer, intent(in) | id | ||
) |
Used in debuggind output of the whole tree.
this | Binary search tree |
lu | Unit for writing |
id | Tree node id |
Definition at line 133 of file congen_bstree.f90.