ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
hamilt::BaseMatrix< T > Class Template Reference

#include <base_matrix.h>

Collaboration diagram for hamilt::BaseMatrix< T >:

Public Member Functions

 BaseMatrix (const int &nrow_, const int &ncol_, T *data_existed=nullptr)
 BaseMatrix (const BaseMatrix< T > &matrix)
 BaseMatrix (BaseMatrix< T > &&matrix)
 ~BaseMatrix ()
void allocate (T *data_array=nullptr, bool if_zero=false)
 allocate memory for the matrix if this->value_begin is not nullptr, it will be neglected if this->value_begin is nullptr, it will allocate memory with size nrow_local * ncol_local
void set_zero ()
 set value in the matrix to zero
void add_array (T *array)
 add an array to the matrix
void add_element (int mu, int nu, const T &value)
 add a single element to the matrix
T & get_value (const size_t &i_row, const size_t &j_col) const
 get value from a whole matrix
T * get_pointer () const
 get pointer of value from a submatrix
BaseMatrix & operator= (const BaseMatrix &other)
BaseMatrix & operator= (BaseMatrix &&other) noexcept
size_t get_memory_size () const
 get total memory size of BaseMatrix
int get_col_size () const
 get col_size for this matrix
int get_row_size () const
 get row_size for this matrix
void set_size (const int &col_size_in, const int &row_size_in)
 set col_size and row_size
void add_array_ts (T *array)
template<typename TSrc>
void add_array_ts (const TSrc *array)

Private Attributes

bool allocated = false
T * value_begin = nullptr
std::mutex mtx
int nrow_local = 0
int ncol_local = 0

Detailed Description

template<typename T>
class hamilt::BaseMatrix< T >

class: BaseMatrix used to store a matrix for atom-pair local Hamiltonian with specific R-index T can be double or std::complex<double> It has two ways to arrange data:

  1. allocate data itself
  2. only access data but be arranged by other class

Constructor & Destructor Documentation

◆ BaseMatrix() [1/3]

template<typename T>
hamilt::BaseMatrix< T >::BaseMatrix ( const int & nrow_,
const int & ncol_,
T * data_existed = nullptr )
Here is the caller graph for this function:

◆ BaseMatrix() [2/3]

template<typename T>
hamilt::BaseMatrix< T >::BaseMatrix ( const BaseMatrix< T > & matrix)
Here is the call graph for this function:

◆ BaseMatrix() [3/3]

template<typename T>
hamilt::BaseMatrix< T >::BaseMatrix ( BaseMatrix< T > && matrix)
Here is the call graph for this function:

◆ ~BaseMatrix()

template<typename T>
hamilt::BaseMatrix< T >::~BaseMatrix ( )

Member Function Documentation

◆ add_array()

template<typename T>
void hamilt::BaseMatrix< T >::add_array ( T * array)

add an array to the matrix

Parameters
arrayarray to be added
Here is the caller graph for this function:

◆ add_array_ts() [1/2]

template<typename T>
template<typename TSrc>
void hamilt::BaseMatrix< T >::add_array_ts ( const TSrc * array)
inline

◆ add_array_ts() [2/2]

template<typename T>
void hamilt::BaseMatrix< T >::add_array_ts ( T * array)
inline
Here is the caller graph for this function:

◆ add_element()

template<typename T>
void hamilt::BaseMatrix< T >::add_element ( int mu,
int nu,
const T & value )
inline

add a single element to the matrix

Parameters
murow index
nucolumn index
valuevalue to be added
Here is the caller graph for this function:

◆ allocate()

template<typename T>
void hamilt::BaseMatrix< T >::allocate ( T * data_array = nullptr,
bool if_zero = false )

allocate memory for the matrix if this->value_begin is not nullptr, it will be neglected if this->value_begin is nullptr, it will allocate memory with size nrow_local * ncol_local

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_col_size()

template<typename T>
int hamilt::BaseMatrix< T >::get_col_size ( ) const
inline

get col_size for this matrix

Here is the caller graph for this function:

◆ get_memory_size()

template<typename T>
size_t hamilt::BaseMatrix< T >::get_memory_size ( ) const

get total memory size of BaseMatrix

◆ get_pointer()

template<typename T>
T * hamilt::BaseMatrix< T >::get_pointer ( ) const
inline

get pointer of value from a submatrix

Here is the caller graph for this function:

◆ get_row_size()

template<typename T>
int hamilt::BaseMatrix< T >::get_row_size ( ) const
inline

get row_size for this matrix

Here is the caller graph for this function:

◆ get_value()

template<typename T>
T & hamilt::BaseMatrix< T >::get_value ( const size_t & i_row,
const size_t & j_col ) const
inline

get value from a whole matrix

Parameters
i_rowrow index
j_colcolumn index
Returns
T&
Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename T>
BaseMatrix< T > & hamilt::BaseMatrix< T >::operator= ( BaseMatrix< T > && other)
noexcept
Here is the call graph for this function:

◆ operator=() [2/2]

template<typename T>
BaseMatrix< T > & hamilt::BaseMatrix< T >::operator= ( const BaseMatrix< T > & other)
Here is the call graph for this function:

◆ set_size()

template<typename T>
void hamilt::BaseMatrix< T >::set_size ( const int & col_size_in,
const int & row_size_in )

set col_size and row_size

◆ set_zero()

template<typename T>
void hamilt::BaseMatrix< T >::set_zero ( )

set value in the matrix to zero

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ allocated

template<typename T>
bool hamilt::BaseMatrix< T >::allocated = false
private

◆ mtx

template<typename T>
std::mutex hamilt::BaseMatrix< T >::mtx
mutableprivate

◆ ncol_local

template<typename T>
int hamilt::BaseMatrix< T >::ncol_local = 0
private

◆ nrow_local

template<typename T>
int hamilt::BaseMatrix< T >::nrow_local = 0
private

◆ value_begin

template<typename T>
T* hamilt::BaseMatrix< T >::value_begin = nullptr
private

The documentation for this class was generated from the following files: