23 BaseMatrix(
const int& nrow_,
const int& ncol_,
T* data_existed =
nullptr);
36 void allocate(
T* data_array =
nullptr,
bool if_zero =
false);
74 T&
get_value(
const size_t& i_row,
const size_t& j_col)
const
110 void set_size(
const int& col_size_in,
const int& row_size_in);
114 std::lock_guard<std::mutex> lock(
mtx);
116 for (
int i = 0; i < size; ++i)
Definition base_matrix.h:20
T * get_pointer() const
get pointer of value from a submatrix
Definition base_matrix.h:86
std::mutex mtx
Definition base_matrix.h:134
void set_size(const int &col_size_in, const int &row_size_in)
set col_size and row_size
Definition base_matrix.cpp:195
void set_zero()
set value in the matrix to zero
Definition base_matrix.cpp:100
BaseMatrix & operator=(const BaseMatrix &other)
Definition base_matrix.cpp:125
void add_array(T *array)
add an array to the matrix
Definition base_matrix.cpp:110
int ncol_local
Definition base_matrix.h:137
int get_col_size() const
get col_size for this matrix
Definition base_matrix.h:102
bool allocated
Definition base_matrix.h:123
void add_element(int mu, int nu, const T &value)
add a single element to the matrix
Definition base_matrix.h:57
int nrow_local
Definition base_matrix.h:136
T & get_value(const size_t &i_row, const size_t &j_col) const
get value from a whole matrix
Definition base_matrix.h:74
int get_row_size() const
get row_size for this matrix
Definition base_matrix.h:106
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->val...
Definition base_matrix.cpp:68
size_t get_memory_size() const
get total memory size of BaseMatrix
Definition base_matrix.cpp:183
T * value_begin
Definition base_matrix.h:129
~BaseMatrix()
Definition base_matrix.cpp:58
void add_array_ts(T *array)
Definition base_matrix.h:112
#define T
Definition exp.cpp:237