38 #ifndef MAT_MATRIXHIERARCHICBASE
39 #define MAT_MATRIXHIERARCHICBASE
48 template<
class Treal,
class Telement = Treal>
54 return this->is_zero();
56 throw Failure(
"Matrix::operator== only implemented for k == 0");
81 (
int row,
int col)
const {
90 inline Telement&
operator[]
94 assert(index < nElements());
97 inline Telement
const &
operator[]
101 assert(index < nElements());
105 inline bool is_zero()
const {
return !
elements;}
107 inline int nElements()
const {
111 inline void resetRows(SizesAndBlocks
const & newRows) {
116 inline void resetCols(SizesAndBlocks
const & newCols) {
122 inline void getRows(SizesAndBlocks & rowsCopy)
const {
125 inline void getCols(SizesAndBlocks & colsCopy)
const {
130 inline bool highestLevel()
const {
140 inline bool is_empty()
const {
149 SizesAndBlocks
const & colsInp)
168 inline void assert_alloc() {
169 if (this->cap < this->nel) {
171 this->cap = this->nel;
172 this->
elements =
new Telement[this->cap];
173 for (
int ind = 0; ind < this->cap; ind++)
184 template<
class Treal,
class Telement>
187 : rows(mat.rows), cols(mat.cols), elements(0) {
188 if (!mat.is_zero()) {
189 elements =
new Telement[nElements()];
190 for (
int i = 0; i < nElements(); i++)
196 template<
class Treal,
class Telement>
207 if (is_zero() || (nElements() != mat.nElements())) {
209 elements =
new Telement[mat.nElements()];
213 for (
int i = 0; i < nElements(); i++)
218 template<
class Treal,
class Telement>
229 template<
class Treal,
class Telement>