35#ifndef _CHOMP_STRUCT_FLATMATR_H_
36#define _CHOMP_STRUCT_FLATMATR_H_
53template <
class element>
64 n (M.
n),
tab (new element [
n *
n])
67 for (
int i = 0; i < memSize; ++ i)
77 throw "Different matrix sizes in operator =.";
79 for (
int i = 0; i < memSize; ++ i)
92 row (
int _offset, element *_v):
141 for (
int i = 0; i < size; ++ i)
150 element *this_tab =
tab;
The class that represents a constant single row of the matrix.
const_row(int _offset, const element *_v)
The constructor of a constant row of the matrix.
const element * v
A reference to the vector that stores all the entries of the matrix.
int offset
The offset in the vector of all the entries of the matrix.
const element & operator[](int m)
Returns a reference to the element at the given position.
The class that represents a single row of the matrix.
element * v
A reference to the vector that stores all the entries of the matrix.
int offset
The offset in the vector of all the entries of the matrix.
element & operator[](int j)
Returns a reference to the element at the given position.
row(int _offset, element *_v)
The constructor of a row of the matrix.
This class defines a simple data structure for a flat 2-dim square matrix whose entries are stored in...
flatMatrix(const flatMatrix< element > &M)
The copy constructor which copies all the entries of the matrix.
int n
The size of the matrix.
const element * memory() const
Returns the address of the memory buffer with the elements of the matrix for reading only.
void clear(const element &elem)
Clears all the entries of the matrix with the provided value.
~flatMatrix()
The destructor which deallocates the memory.
void swap(flatMatrix< element > &M)
Swaps the memory of two flat matrices.
element * memory()
Returns the address of the memory buffer with the elements of the matrix for reading and writing.
flatMatrix & operator=(const flatMatrix< element > &M)
The assignment operator.
element * tab
The array of elements.
flatMatrix(int size)
The main constructor.
row operator[](int i)
Returns a row of the matrix.
This namespace contains the entire CHomP library interface.