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

matrixdata_inline.hh

Go to the documentation of this file.
00001 #ifndef _MATRIXDATA_INLINE_HH_
00002 #define _MATRIXDATA_INLINE_HH_
00003 
00004 // This header contains definitions of inlined Matrix::MatrixData members.
00005 // It is designed to be included only in matrix_ops.cc and nowhere else.
00006 
00007 //
00008 // Data extaction
00009 //
00010 
00011 inline double* Matrix::MatrixData::GetPr() {
00012   return re;
00013 }
00014 inline const double* Matrix::MatrixData::GetPr() const {
00015   return re;
00016 }
00017 inline double* Matrix::MatrixData::GetPi() {
00018   return im;
00019 }
00020 inline const double* Matrix::MatrixData::GetPi() const {
00021   return im;
00022 }
00023 
00024 //
00025 // Indexing
00026 //
00027 inline int Matrix::MatrixData::DoubleToSingleIndex(int i, int j) const {
00028   return (i-1)+(j-1)*m;  // Column major, (1,1) indexing to [0]
00029 }
00030 inline double Matrix::MatrixData::index(int i) const {
00031 
00032   if (l == 0)
00033     handle_exception(MatrixEmptyMatrixException(__FILE__, __LINE__));
00034   if (i <= 0)
00035     handle_exception(MatrixZeroIndexException(__FILE__, __LINE__));
00036   if (i > l) {
00037     handle_exception(MatrixArrayBoundsException(__FILE__, __LINE__));
00038   }
00039   
00040   return re[i-1];
00041 }
00042 inline double& Matrix::MatrixData::index(int i) {
00043 
00044   if (l == 0)
00045     handle_exception(MatrixEmptyMatrixException(__FILE__, __LINE__));
00046   if (i <= 0)
00047     handle_exception(MatrixZeroIndexException(__FILE__, __LINE__));
00048   if (i > l)
00049     handle_exception(MatrixArrayBoundsException(__FILE__, __LINE__));
00050 
00051   return re[i-1];
00052 }
00053 inline double Matrix::MatrixData::index(int i, int j) const {
00054   if (l == 0)
00055     handle_exception(MatrixEmptyMatrixException(__FILE__, __LINE__));
00056   if (i <= 0 || j <= 0)
00057     handle_exception(MatrixZeroIndexException(__FILE__, __LINE__));
00058   if (i > m || j > n)
00059     handle_exception(MatrixArrayBoundsException(__FILE__, __LINE__));
00060   
00061   return re[DoubleToSingleIndex(i,j)];
00062 }
00063 inline double& Matrix::MatrixData::index(int i, int j) {
00064   if (l == 0)
00065     handle_exception(MatrixEmptyMatrixException(__FILE__, __LINE__));
00066   if (i <= 0 || j <= 0)
00067     handle_exception(MatrixZeroIndexException(__FILE__, __LINE__));
00068   if (i > m || j > n)
00069     handle_exception(MatrixArrayBoundsException(__FILE__, __LINE__));
00070   
00071   return re[DoubleToSingleIndex(i,j)];
00072 }
00073 
00074 
00075 #endif

Generated on Wed Jun 18 09:16:21 2003 for admc++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002