ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
#include <base_matrix.h>
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) |
Private Attributes | |
bool | allocated = false |
T * | value_begin = nullptr |
std::mutex | mtx |
int | nrow_local = 0 |
int | ncol_local = 0 |
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:
hamilt::BaseMatrix< T >::BaseMatrix | ( | const int & | nrow_, |
const int & | ncol_, | ||
T * | data_existed = nullptr |
||
) |
hamilt::BaseMatrix< T >::BaseMatrix | ( | const BaseMatrix< T > & | matrix | ) |
hamilt::BaseMatrix< T >::BaseMatrix | ( | BaseMatrix< T > && | matrix | ) |
hamilt::BaseMatrix< T >::~BaseMatrix | ( | ) |
void hamilt::BaseMatrix< T >::add_array | ( | T * | array | ) |
add an array to the matrix
array | array to be added |
|
inline |
|
inline |
add a single element to the matrix
mu | row index |
nu | column index |
value | value to be added |
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
|
inline |
get col_size for this matrix
size_t hamilt::BaseMatrix< T >::get_memory_size | ( | ) | const |
get total memory size of BaseMatrix
|
inline |
get pointer of value from a submatrix
|
inline |
get row_size for this matrix
|
inline |
get value from a whole matrix
i_row | row index |
j_col | column index |
|
noexcept |
BaseMatrix< T > & hamilt::BaseMatrix< T >::operator= | ( | const BaseMatrix< T > & | other | ) |
void hamilt::BaseMatrix< T >::set_size | ( | const int & | col_size_in, |
const int & | row_size_in | ||
) |
set col_size and row_size
void hamilt::BaseMatrix< T >::set_zero | ( | ) |
set value in the matrix to zero
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |