7 #include <tbb/scalable_allocator.h> 18 template<
typename scalar>
70 references = (int64_t*)malloc(
sizeof(
new int64_t));
82 matrix_base( scalar* data_in,
size_t rows_in,
size_t cols_in) {
102 references = (int64_t*)malloc(
sizeof(
new int64_t));
135 references = (int64_t*)malloc(
sizeof(
new int64_t));
243 references = (int64_t*)malloc(
sizeof(
new int64_t));
255 bool call_delete =
false;
262 call_delete = ((*references)==1);
268 scalable_aligned_free(
data);
385 std::cout << std::endl <<
"The stored matrix:" << std::endl;
386 for (
size_t row_idx=0; row_idx <
rows; row_idx++ ) {
387 for (
size_t col_idx=0; col_idx <
cols; col_idx++ ) {
388 size_t element_idx = row_idx*
cols + col_idx;
389 std::cout <<
" " <<
data[element_idx].real <<
" " <<
data[element_idx].imag <<
"*i";
391 std::cout << std::endl;
393 std::cout << std::endl << std::endl << std::endl;
size_t rows
The number of rows.
bool owner
logical value indicating whether the class instance is the owner of the stored data or not....
scalar * data
pointer to the stored data
scalar * get_data()
Call to get the pointer to the stored data.
void release_data()
Call to release the data stored by the matrix.
bool transposed
logical variable indicating whether the matrix needs to be transposed in CBLAS operations
bool conjugated
logical variable indicating whether the matrix needs to be conjugated in CBLAS operations
~matrix_base()
Destructor of the class.
bool is_conjugated()
Call to get whether the matrix should be conjugated in CBLAS functions or not.
Base Class to store data of arrays and its properties.
void operator=(const matrix_base &mtx)
Assignment operator.
size_t cols
The number of columns.
matrix_base(size_t rows_in, size_t cols_in)
Constructor of the class.
void replace_data(scalar *data_in, bool owner_in)
Call to replace the stored data by an another data array.
Custom types for the QGD package.
void set_owner(bool owner_in)
Call to set the current class instance to be (or not to be) the owner of the stored data array.
void print_matrix()
Call to prints the stored matrix on the standard output.
void transpose()
Call to transpose (or un-transpose) the matrix for CBLAS functions.
matrix_base()
Default constructor of the class.
matrix_base< scalar > copy()
Call to create a copy of the matrix.
scalar & operator[](size_t idx)
Operator [] to access elements in array style (does not check the boundaries of the stored array)
void conjugate()
Call to conjugate (or un-conjugate) the matrix for CBLAS functions.
matrix_base(const matrix_base< scalar > &in)
Copy constructor of the class.
int64_t * references
the number of the current references of the present object
size_t size()
Call to get the number of the allocated elements.
matrix_base(scalar *data_in, size_t rows_in, size_t cols_in)
Constructor of the class.
tbb::spin_mutex * reference_mutex
mutual exclusion to count the references for class instances referring to the same data.
bool is_transposed()
Call to get whether the matrix should be conjugated in CBLAS functions or not.