SubMatrix< T > Class Template Reference

#include <SubMatrix.h>

List of all members.


Detailed Description

template<class T>
class SubMatrix< T >

A 2-D slice of a Matrix. Does not contain its own data. Needs to be referenced to a Matrix.

Definition at line 85 of file SubMatrix.h.

Public Member Functions

 SubMatrix (void)
 SubMatrix (SubMatrix< T > &sm)
 ~SubMatrix (void)
const int Columns () const
const int Rows () const
const int XDim () const
const int YDim () const
const List< int, 2 > Size () const
SubMatrix< T > & operator= (SubMatrix< T > &sm)
T & operator() (const int i, const int j)
Vector< T > & operator[] (const int i)

Protected Attributes

Vector< T > * columns
Cleaner< T > * clean
int xDim
int yDim

Friends

class Matrix<T>
class Vector<T>


Constructor & Destructor Documentation

template<class T>
SubMatrix< T >::SubMatrix void   ) 
 

Definition at line 61 of file SubMatrix.inl.

References SubMatrix< T >::clean, SubMatrix< T >::columns, SubMatrix< T >::xDim, and SubMatrix< T >::yDim.

00062 {
00063     xDim = 0;
00064     yDim = 0;
00065     columns = 0;
00066     clean = 0;
00067 }

template<class T>
SubMatrix< T >::SubMatrix SubMatrix< T > &  sm  ) 
 

Definition at line 71 of file SubMatrix.inl.

References SubMatrix< T >::clean, SubMatrix< T >::columns, SubMatrix< T >::xDim, and SubMatrix< T >::yDim.

00072 {
00073     xDim = m.xDim;
00074     yDim = m.yDim;
00075     columns = m.columns;
00076     clean = new Cleaner<T>(columns);
00077 
00078 }

template<class T>
SubMatrix< T >::~SubMatrix void   ) 
 

Definition at line 84 of file SubMatrix.inl.

References SubMatrix< T >::clean.

00085 {
00086     
00087     if(clean != 0)
00088     {
00089         delete clean;
00090     }
00091 
00092 }


Member Function Documentation

template<class T>
const int SubMatrix< T >::Columns  )  const [inline]
 

Definition at line 103 of file SubMatrix.inl.

00104 {
00105     return xDim;
00106 }

template<class T>
T & SubMatrix< T >::operator() const int  i,
const int  j
[inline]
 

Definition at line 151 of file SubMatrix.inl.

References SubMatrix< T >::columns, and Utility::RunTimeError().

00152 {
00153     if(i<0 || i>=dims[0] || j<0 || j>=dims[1])
00154     {
00155         cerr << "Line: " << __LINE__ << " File: " << __FILE__ << endl;
00156         Utility::RunTimeError("Index outside bounds!");
00157     }
00158 
00159     return columns[i].data[j];
00160 
00161 }

template<class T>
SubMatrix< T > & SubMatrix< T >::operator= SubMatrix< T > &  sm  ) 
 

Definition at line 135 of file SubMatrix.inl.

References SubMatrix< T >::clean, SubMatrix< T >::columns, SubMatrix< T >::xDim, and SubMatrix< T >::yDim.

00136 {
00137     xDim = m.xDim;
00138     yDim = m.yDim;
00139     columns = m.columns;
00140     delete clean;
00141     clean = new Cleaner<T>(columns);
00142     
00143     
00144     return *this;
00145 }

template<class T>
Vector< T > & SubMatrix< T >::operator[] const int  i  )  [inline]
 

Definition at line 164 of file SubMatrix.inl.

References SubMatrix< T >::columns.

00165 {
00166     return columns[i];
00167 }

template<class T>
const int SubMatrix< T >::Rows  )  const [inline]
 

Definition at line 109 of file SubMatrix.inl.

00110 {
00111     return yDim;
00112 }

template<class T>
const List< int, 2 > SubMatrix< T >::Size  )  const [inline]
 

Definition at line 129 of file SubMatrix.inl.

00130 {
00131     return List(dims[1],dims[0]);
00132 }

template<class T>
const int SubMatrix< T >::XDim  )  const [inline]
 

Definition at line 116 of file SubMatrix.inl.

00117 {
00118     return xDim;
00119 }

template<class T>
const int SubMatrix< T >::YDim  )  const [inline]
 

Definition at line 122 of file SubMatrix.inl.

00123 {
00124     return yDim;
00125 }


Friends And Related Function Documentation

template<class T>
friend class Matrix<T> [friend]
 

Definition at line 87 of file SubMatrix.h.

template<class T>
friend class Vector<T> [friend]
 

Definition at line 88 of file SubMatrix.h.


Member Data Documentation

template<class T>
Cleaner<T>* SubMatrix< T >::clean [protected]
 

Definition at line 92 of file SubMatrix.h.

Referenced by SubMatrix< T >::operator=(), Matrix< T >::Slice(), SubMatrix< T >::SubMatrix(), and SubMatrix< T >::~SubMatrix().

template<class T>
Vector<T>* SubMatrix< T >::columns [protected]
 

Definition at line 91 of file SubMatrix.h.

Referenced by SubMatrix< T >::operator()(), SubMatrix< T >::operator=(), SubMatrix< T >::operator[](), Matrix< T >::Slice(), and SubMatrix< T >::SubMatrix().

template<class T>
int SubMatrix< T >::xDim [protected]
 

Definition at line 93 of file SubMatrix.h.

Referenced by SubMatrix< T >::operator=(), Matrix< T >::Slice(), and SubMatrix< T >::SubMatrix().

template<class T>
int SubMatrix< T >::yDim [protected]
 

Definition at line 94 of file SubMatrix.h.

Referenced by SubMatrix< T >::operator=(), Matrix< T >::Slice(), and SubMatrix< T >::SubMatrix().


The documentation for this class was generated from the following files:
CIMPL 0.1 Code Reference. Copyright © 2004, Baris Sumengen. All rights reserved.