![]() |
Gowdy solver
|
A matrix (a two-dimensional array) of elements. More...
#include <matrix.h>
Public Types | |
typedef T | value_type |
Makes T available externally. | |
Public Member Functions | |
Matrix () | |
~Matrix () | |
Matrix (Int n, Int m) | |
Matrix (Int n, Int m, const T &c) | |
Matrix (Int n, Int m, const T *ap) | |
Matrix (const Matrix &rhs) | |
Matrix< T > & | operator= (const Matrix< T > &rhs) |
The matrix assignment. | |
T * | operator[] (const Int i) |
Returns the pointer to a row. | |
const T * | operator[] (const Int i) const |
Int | nrows () const |
Int | ncols () const |
void | resize (Int newn, Int newm) |
void | assign (Int newn, Int newm, const T &c) |
Private Attributes | |
Int | nn |
The number of rows. | |
Int | mm |
The number of columns. | |
T ** | v |
The elements of the two-dimensional array. |
A matrix (a two-dimensional array) of elements.
typedef T Matrix< T >::value_type |
Definition at line 323 of file matrix.h.
{ Int i,j,nel; if( newn != nn || newm != mm ) { if( v != NULL ) { delete[] v[0]; delete[] v; } nn = newn; mm = newm; v = nn>0 ? new T*[nn] : NULL; nel = mm*nn; if( v ) v[0] = nel>0 ? new T[nel] : NULL; for( i = 1; i < nn; ++i ) v[i] = v[i-1] + mm; } for( i = 0; i < nn; ++i ) for( j = 0; j<mm; ++j ) v[i][j] = c; }
The matrix assignment.
Postcondition: normal assignment via copying has been performed; If matrix and rhs were different sizes, matrix has been resized to match the size of rhs
Definition at line 253 of file matrix.h.
{ if( this != &rhs ) { Int i,j,nel; if (nn != rhs.nn || mm != rhs.mm) { if (v != NULL) { delete[] v[0]; delete[] v; } nn=rhs.nn; mm=rhs.mm; v = nn>0 ? new T*[nn] : NULL; nel = mm*nn; if( v ) { v[0] = nel > 0 ? new T[nel] : NULL; } for( i = 1; i< nn; ++i ) v[i] = v[i-1] + mm; } for( i = 0; i< nn; ++i ) for( j = 0; j<mm; ++j ) v[i][j] = rhs[i][j]; } return *this; }
Returns the pointer to a row.
Definition at line 281 of file matrix.h.
{ assertBounds( i >= 0 && i < nn, "Matrix subscript out of bounds" ); return v[i]; }
Definition at line 287 of file matrix.h.
{ assertBounds( i >= 0 && i < nn, "Matrix subscript out of bounds" ); return v[i]; }
The number of columns.
Definition at line 163 of file matrix.h.
Referenced by Matrix< Real >::assign(), Matrix< Real >::Matrix(), Matrix< Real >::ncols(), Matrix< Real >::operator=(), and Matrix< Real >::resize().
The number of rows.
Definition at line 162 of file matrix.h.
Referenced by Matrix< Real >::assign(), Matrix< Real >::Matrix(), Matrix< Real >::nrows(), Matrix< Real >::operator=(), Matrix< Real >::operator[](), and Matrix< Real >::resize().
The elements of the two-dimensional array.
Definition at line 164 of file matrix.h.
Referenced by Matrix< Real >::assign(), Matrix< Real >::Matrix(), Matrix< Real >::operator=(), Matrix< Real >::operator[](), Matrix< Real >::resize(), and Matrix< Real >::~Matrix().