Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

Atlfast::Matrix Class Reference

#include <Matrix.h>

List of all members.


Public Methods

 Matrix (size_t x, size_t y)
 Matrix (size_t x, size_t y, double init)
 Matrix (const Matrix &)
Matrix & operator= (const Matrix &)
 ~Matrix ()
size_t size () const
size_t dim1 () const
size_t dim2 () const
Slice_iter< double > row (size_t i)
Cslice_iter< double > row (size_t i) const
Slice_iter< double > column (size_t i)
Cslice_iter< double > column (size_t i) const
double & operator() (size_t x, size_t y)
double operator() (size_t x, size_t y) const
Slice_iter< double > operator() (size_t i)
Cslice_iter< double > operator() (size_t i) const
Slice_iter< double > operator[] (size_t i)
Cslice_iter< double > operator[] (size_t i) const
Matrix & operator *= (double)
valarray< double > & array ()
Matrix sub (int minRow, int maxRow, int minCol, int maxCol) const
void sub (int minRow, int minCol, Matrix &dest) const

Private Attributes

valarray< double > * m_v
size_t m_d1
size_t m_d2

Constructor & Destructor Documentation

Atlfast::Matrix::Matrix size_t    x,
size_t    y
 

Definition at line 5 of file Matrix.cxx.

References m_d1, m_d2, and m_v.

00005                                   {
00006     m_d1=x;
00007     m_d2=y;
00008     m_v=new valarray<double>(x*y);
00009   }

Atlfast::Matrix::Matrix size_t    x,
size_t    y,
double    init
 

Definition at line 11 of file Matrix.cxx.

References m_d1, m_d2, and m_v.

00011                                                {
00012     m_d1=x;
00013     m_d2=y;
00014     m_v=new valarray<double>(x*y);
00015     for(size_t i=0; i<m_d1*m_d2; ++i)  m_v[i]=init;
00016   }

Atlfast::Matrix::Matrix const Matrix &   
 

Atlfast::Matrix::~Matrix  
 


Member Function Documentation

Matrix& Atlfast::Matrix::operator= const Matrix &   
 

size_t Atlfast::Matrix::size   const [inline]
 

Definition at line 34 of file Matrix.h.

References m_d1, and m_d2.

00034 {return m_d1*m_d2;}

size_t Atlfast::Matrix::dim1   const [inline]
 

Definition at line 35 of file Matrix.h.

References m_d1.

00035 {return m_d1;}

size_t Atlfast::Matrix::dim2   const [inline]
 

Definition at line 36 of file Matrix.h.

References m_d2.

Referenced by Atlfast::operator *().

00036 {return m_d2;}

Slice_iter< double > Atlfast::Matrix::row size_t    i [inline]
 

Definition at line 61 of file Matrix.h.

References m_d1, m_d2, and m_v.

Referenced by Atlfast::operator *().

00061                                                {
00062     return Slice_iter<double>(m_v, slice(i,m_d1,m_d2));
00063   }

Cslice_iter< double > Atlfast::Matrix::row size_t    i const [inline]
 

Definition at line 65 of file Matrix.h.

References m_d1, m_d2, and m_v.

00065                                                        {
00066     return Cslice_iter<double>(m_v, slice(i,m_d1,m_d2));
00067   }

Slice_iter< double > Atlfast::Matrix::column size_t    i [inline]
 

Definition at line 69 of file Matrix.h.

References m_d2, and m_v.

Referenced by operator()(), and operator[]().

00069                                                   {
00070     return Slice_iter<double>(m_v, slice(i*m_d2,m_d2,1));
00071   }

Cslice_iter< double > Atlfast::Matrix::column size_t    i const [inline]
 

Definition at line 73 of file Matrix.h.

References m_d2, and m_v.

00073                                                           {
00074     return Cslice_iter<double>(m_v, slice(i*m_d2,m_d2,1));
00075   }

double & Atlfast::Matrix::operator() size_t    x,
size_t    y
 

Definition at line 18 of file Matrix.cxx.

References column().

00018                                               {
00019     return column(x)[y];
00020   }

double Atlfast::Matrix::operator() size_t    x,
size_t    y
const
 

Slice_iter<double> Atlfast::Matrix::operator() size_t    i [inline]
 

Definition at line 47 of file Matrix.h.

References column().

00047 {return column(i);}

Cslice_iter<double> Atlfast::Matrix::operator() size_t    i const [inline]
 

Definition at line 48 of file Matrix.h.

References column().

00048 {return column(i);}

Slice_iter<double> Atlfast::Matrix::operator[] size_t    i [inline]
 

Definition at line 50 of file Matrix.h.

References column().

00050 {return column(i);}

Cslice_iter<double> Atlfast::Matrix::operator[] size_t    i const [inline]
 

Definition at line 51 of file Matrix.h.

References column().

00051 {return column(i);}

Matrix & Atlfast::Matrix::operator *= double   
 

Definition at line 35 of file Matrix.cxx.

00035                                     {
00036     (*m_v) *= d;
00037     return *this;
00038   }

valarray<double>& Atlfast::Matrix::array   [inline]
 

Definition at line 55 of file Matrix.h.

References m_v.

00055 {return *m_v;}

Matrix Atlfast::Matrix::sub int    minRow,
int    maxRow,
int    minCol,
int    maxCol
const
 

Definition at line 39 of file Matrix.cxx.

References m_d1, and m_d2.

00040                                                   {
00041     int endRow=maxRow+1;
00042     int endCol=maxCol+1;
00043 
00044     assert(minRow>=0);
00045     assert(minCol>=0);
00046     assert(endRow<=m_d1);
00047     assert(endCol<=m_d2);
00048 
00049     int nRow=endRow-minRow;
00050     assert(nRow>0);
00051     
00052     int nCol=endCol-minCol;
00053     assert(nCol>0);
00054 
00055     Matrix m(nRow, nCol);
00056     int ii=0;
00057     int jj;
00058     for(int i = minRow; i<endRow; ++i){
00059       jj=0;
00060       for(int j = minCol; j<endCol; ++j) m[ii][jj++]=(*this)[i][j];
00061       ++ii;
00062     }
00063     assert(ii == endRow);
00064     assert(jj == endCol);
00065     return m;
00066   }

void Atlfast::Matrix::sub int    minRow,
int    minCol,
Matrix &    dest
const
 

Definition at line 67 of file Matrix.cxx.

References m_d1, and m_d2.

00067                                                          {
00068     int endRow=minRow+m.m_d1;
00069     int endCol=minCol+m.m_d2;
00070 
00071     assert(minRow>=0);
00072     assert(minCol>=0);
00073     assert(endRow<=m_d1);
00074     assert(endCol<=m_d2);
00075 
00076     int nRow=endRow-minRow;
00077     assert(nRow>0);
00078     
00079     int nCol=endCol-minCol;
00080     assert(nCol>0);
00081 
00082     int ii=0;
00083     int jj;
00084     for(int i = minRow; i<endRow; ++i){
00085       jj=0;
00086       for(int j = minCol; j<endCol; ++j) m[ii][jj++]=(*this)[i][j];
00087       ++ii;
00088     }
00089     assert(ii == endRow);
00090     assert(jj == endCol);
00091     return;
00092   }

Member Data Documentation

valarray<double>* Atlfast::Matrix::m_v [private]
 

Definition at line 25 of file Matrix.h.

Referenced by array(), column(), Matrix(), and row().

size_t Atlfast::Matrix::m_d1 [private]
 

Definition at line 26 of file Matrix.h.

Referenced by dim1(), Matrix(), row(), size(), and sub().

size_t Atlfast::Matrix::m_d2 [private]
 

Definition at line 26 of file Matrix.h.

Referenced by column(), dim2(), Matrix(), row(), size(), and sub().


The documentation for this class was generated from the following files:
Generated on Wed Jan 15 11:00:34 2003 for AtlfastUtils by doxygen1.3-rc1