23 #ifndef _MatrixTmplDec_
24 #define _MatrixTmplDec_
38 MatrixTmpl(
unsigned int dim1,
unsigned int dim2);
82 "Determinant only valid for square matrices");
101 for(
unsigned int j=0; j<
mNumRows; j++)
102 ret(i,j) = (*this)(j,i);
111 for(
unsigned int j=0; j<
mNumRows; j++)
112 ret(i,j) = (*this)(j,i);
119 for (
unsigned int i=0; i<
mNumRows; i++)
130 "Inverse can only be calculated for square matrix");
133 for (
unsigned int i=0; i<
mNumRows; i++)
134 for (
unsigned int j=0; j<
mNumRows; j++)
147 "Inverse can only be calculated for square matrix");
161 for (
unsigned i=0;i<row;i++)
166 for (
unsigned i=row;i<
mNumRows-1;i++)
181 for(
unsigned j=0;j<column;j++)
225 void SetAt (
unsigned int iPosition,
unsigned int jPosition, T element)
228 "Index beyond matrix dimension");
230 "Index beyond matrix dimension");
232 "Index beyond matrix dimension");
234 "Index beyond matrix dimension");
239 T
GetAt (
unsigned int iPosition,
unsigned int jPosition)
const
242 "Index beyond matrix dimension");
244 "Index beyond matrix dimension");
246 "Index beyond matrix dimension");
248 "Index beyond matrix dimension");
257 "Column beyond matrix dimensions");
259 "Column beyond matrix dimensions");
262 for (
unsigned int i=0; i<m.
mNumRows; i++)
263 ret(i,0) = m(i,column);
271 "Row beyond matrix dimensions");
273 "Row beyond matrix dimensions");
285 for (
unsigned int i=0; i<
mNumRows; i++)
287 (*
this)(i,j) = f( (*
this)(i,j) );
290 void Apply( T (*f)(T,
int),
int parameter )
292 for (
unsigned int i=0; i<
mNumRows; i++)
294 (*
this)(i,j) = f( (*
this)(i,j), parameter );
300 for (
unsigned int i=0; i<m.
mNumRows; i++)
302 ret(i,j) = T(f( m(i,j) ));
309 for (
unsigned int i=0; i<m.
mNumRows; i++)
311 ret(i,j) = abs( m(i,j) );
316 T&
operator () (
unsigned int iPosition,
unsigned int jPosition)
const {
318 "Index beyond matrix dimension");
320 "Index beyond matrix dimension");
322 "Index beyond matrix dimension");
324 "Index beyond matrix dimension");
372 for (
unsigned int i=0; i<ret.
mNumRows; i++)
374 ret(i,j) = m1(i,j) + m2(i,j);
382 for (
unsigned int i=0; i<ret.
mNumRows; i++)
384 ret(i,j) = m1(i,j) + element;
393 for (
unsigned int i=0; i<ret.
mNumRows; i++)
395 ret(i,j) = m1(i,j) - m2(i,j);
403 for (
unsigned int i=0; i<ret.
mNumRows; i++)
405 ret(i,j) = m1(i,j) - element;
421 for (
unsigned int i=0; i<ret.
mNumRows; i++)
425 ret(i,j) += m1(i,k)*m2(k,j);
465 std::ostream& operator << (std::ostream & stream, const MatrixTmpl<T> & a);
469 #endif // _MatrixTmplDec_