CONGEN  5.0
Configuration generation for SCATCI
congen_bstree Module Reference

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...
 

Detailed Description

Authors
J Benda
Date
2018 - 2019

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.

Function/Subroutine Documentation

◆ compare_determinats()

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 
)
Authors
J Benda
Date
2018 - 2019

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.

Parameters
thisDeterminant tree object to use
iIndex of the first determinant
jIndex of the second determinant
dataAdditional payload required by base class interface. Not used in congen.
Returns
-1 if the first determinant is lexicographically less, 0 if they are equal, +1 if the first is greater.

Definition at line 172 of file congen_bstree.f90.

◆ final_det_tree()

subroutine congen_bstree::final_det_tree ( type(det_tree), intent(inout)  this)
Authors
J Benda
Date
2019

Releases all allocated memory.

Parameters
thisTree object to finalize

Definition at line 90 of file congen_bstree.f90.

Referenced by congen_bstree::det_tree::final_det_tree().

Here is the caller graph for this function:

◆ init_det_tree()

subroutine congen_bstree::init_det_tree ( class(det_tree), intent(inout)  this,
integer, dimension(:), intent(in), pointer  ndo,
integer, intent(in)  nelt 
)
Authors
J Benda
Date
2019

Stores pointer to the determinant storage, so that it can be used when comparing determinant indices in the binary search tree subroutines.

Parameters
thisTree object to initialize
ndoDeterminant storage
neltSize of a determinant

Definition at line 68 of file congen_bstree.f90.

◆ locate_in_det_tree()

integer function congen_bstree::locate_in_det_tree ( class(det_tree), intent(inout)  this,
integer, dimension(this % nelt), intent(in)  det 
)
Authors
J Benda
Date
2019

Return index in the determinant storage, where the given determinant is located. Return -1 when there is no such determinant.

Parameters
thisTree object to search
detDeterminant to find (length nelt)

Definition at line 111 of file congen_bstree.f90.

◆ write_determinant()

subroutine congen_bstree::write_determinant ( class(det_tree), intent(in)  this,
integer, intent(in)  lu,
integer, intent(in)  id 
)
Authors
J Benda
Date
2019

Used in debuggind output of the whole tree.

Parameters
thisBinary search tree
luUnit for writing
idTree node id

Definition at line 133 of file congen_bstree.f90.