Classes | Public Member Functions | Protected Attributes

chomp::homology::flatMatrix< element > Class Template Reference

This class defines a simple data structure for a flat 2-dim square matrix whose entries are stored in a single array. More...

#include <chomp/struct/flatmatr.h>

List of all members.

Classes

class  const_row
 The class that represents a constant single row of the matrix. More...
class  row
 The class that represents a single row of the matrix. More...

Public Member Functions

 flatMatrix (int size)
 The main constructor.
 flatMatrix (const flatMatrix< element > &M)
 The copy constructor which copies all the entries of the matrix.
flatMatrixoperator= (const flatMatrix< element > &M)
 The assignment operator.
 ~flatMatrix ()
 The destructor which deallocates the memory.
row operator[] (int i)
 Returns a row of the matrix.
const_row operator[] (int i) const
 Returns a constant row of the matrix.
void clear (const element &elem)
 Clears all the entries of the matrix with the provided value.
void swap (flatMatrix< element > &M)
 Swaps the memory of two flat matrices.
const element * memory () const
 Returns the address of the memory buffer with the elements of the matrix for reading only.
element * memory ()
 Returns the address of the memory buffer with the elements of the matrix for reading and writing.

Protected Attributes

int n
 The size of the matrix.
element * tab
 The array of elements.

Detailed Description

template<class element>
class chomp::homology::flatMatrix< element >

This class defines a simple data structure for a flat 2-dim square matrix whose entries are stored in a single array.

Additional classes for a row and a constant row are defined within this class which allow to use the usual double indexing to get to the entries of the matrix, both for reading only and for modifying the entries, e.g., M[0][1].

Definition at line 55 of file flatmatr.h.


Constructor & Destructor Documentation

template<class element>
chomp::homology::flatMatrix< element >::flatMatrix ( int  size ) [inline]

The main constructor.

The size of the matrix (the number of rows and collumns) must be given at initialization.

Definition at line 61 of file flatmatr.h.

template<class element>
chomp::homology::flatMatrix< element >::flatMatrix ( const flatMatrix< element > &  M ) [inline]

The copy constructor which copies all the entries of the matrix.

Definition at line 64 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::n, and chomp::homology::flatMatrix< element >::tab.

template<class element>
chomp::homology::flatMatrix< element >::~flatMatrix (  ) [inline]

The destructor which deallocates the memory.

Definition at line 86 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::tab.


Member Function Documentation

template<class element>
void chomp::homology::flatMatrix< element >::clear ( const element &  elem ) [inline]

Clears all the entries of the matrix with the provided value.

Definition at line 139 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::n, and chomp::homology::flatMatrix< element >::tab.

template<class element>
element* chomp::homology::flatMatrix< element >::memory (  ) [inline]

Returns the address of the memory buffer with the elements of the matrix for reading and writing.

Definition at line 165 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::tab.

template<class element>
const element* chomp::homology::flatMatrix< element >::memory (  ) const [inline]

Returns the address of the memory buffer with the elements of the matrix for reading only.

Definition at line 161 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::tab.

template<class element>
flatMatrix& chomp::homology::flatMatrix< element >::operator= ( const flatMatrix< element > &  M ) [inline]

The assignment operator.

It is permitted only for matrices of the same size. It copies all the entries of the matrix.

Definition at line 75 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::n, and chomp::homology::flatMatrix< element >::tab.

template<class element>
row chomp::homology::flatMatrix< element >::operator[] ( int  i ) [inline]

Returns a row of the matrix.

Definition at line 110 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::n, and chomp::homology::flatMatrix< element >::tab.

template<class element>
const_row chomp::homology::flatMatrix< element >::operator[] ( int  i ) const [inline]

Returns a constant row of the matrix.

Definition at line 135 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::n, and chomp::homology::flatMatrix< element >::tab.

template<class element>
void chomp::homology::flatMatrix< element >::swap ( flatMatrix< element > &  M ) [inline]

Swaps the memory of two flat matrices.

Definition at line 148 of file flatmatr.h.

References chomp::homology::flatMatrix< element >::n, and chomp::homology::flatMatrix< element >::tab.


Member Data Documentation

template<class element>
int chomp::homology::flatMatrix< element >::n [protected]
template<class element>
element* chomp::homology::flatMatrix< element >::tab [protected]

The documentation for this class was generated from the following file: