latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * This file is part of the LTI-Computer Vision Library (LTI-Lib) 00006 * 00007 * The LTI-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License (LGPL) 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * The LTI-Lib is distributed in the hope that it will be 00013 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00014 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with the LTI-Lib; see the file LICENSE. If 00019 * not, write to the Free Software Foundation, Inc., 59 Temple Place - 00020 * Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 00023 00024 /*---------------------------------------------------------------- 00025 * project ....: LTI Digital Image/Signal Processing Library 00026 * file .......: ltiTriMatrix.h 00027 * authors ....: Pablo Alvarado 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 28.04.99 00030 * revisions ..: $Id: ltiTriMatrix.h,v 1.4 2006/02/08 12:49:09 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_TRIMATRIX_H_ 00034 #define _LTI_TRIMATRIX_H_ 00035 00036 #include "ltiMathObject.h" 00037 00038 namespace lti { 00039 00040 /** 00041 * triMatrix is a very simple class to optimize memory usage when using an 00042 * square triangular matrix with following form: 00043 * 00044 * \code 00045 * 00046 * x x x x x x 00047 * x x x x x 00048 * x x x x 00049 * x x x 00050 * x x 00051 * x 00052 * 00053 * \endcode 00054 * 00055 * @ingroup gAggregate 00056 */ 00057 template <class T> 00058 class triMatrix : public mathObject { 00059 public: 00060 00061 /** 00062 * type of the contained data 00063 */ 00064 typedef T value_type; 00065 00066 /** 00067 * return type of the size() member 00068 */ 00069 typedef int size_type; 00070 00071 /** 00072 * default constructor 00073 */ 00074 triMatrix(); 00075 00076 /** 00077 * constructor with a default size. The matrix will be a y times y 00078 * diagonal matrix. 00079 */ 00080 triMatrix(const int y); 00081 00082 /** 00083 * copy constructor 00084 */ 00085 triMatrix(const triMatrix<T>& x); 00086 00087 /** 00088 * destructor 00089 */ 00090 virtual ~triMatrix(); 00091 00092 /** 00093 * read/write access operator. 00094 * @param y which row 00095 * @param x which column 00096 */ 00097 T& at(const int y, const int x); 00098 00099 /** 00100 * read-only access operator. 00101 * @param y which row 00102 * @param x which column 00103 */ 00104 const T& at(const int y, const int x) const; 00105 00106 /** 00107 * return a pointer to the begin of the given row 00108 */ 00109 T* operator[] (const int y); 00110 00111 /** 00112 * return a pointer to the begin of the given row 00113 */ 00114 const T* operator[] (const int y) const; 00115 00116 /** 00117 * copy the other matrix 00118 */ 00119 triMatrix<T>& operator= (const triMatrix<T>& x); 00120 00121 /** 00122 * copy the other matrix 00123 */ 00124 triMatrix<T>& copy(const triMatrix<T>& x); 00125 00126 /** 00127 * return the number of rows (or columns) of this matrix 00128 */ 00129 inline int size() const {return (dimension);}; 00130 00131 /** 00132 * returns the name of this class 00133 */ 00134 virtual const char* getTypeName() const { 00135 return "triMatrix"; 00136 }; 00137 00138 /** 00139 * returns a copy of this object 00140 */ 00141 virtual mathObject* clone() const; 00142 00143 /** 00144 * write the object in the given ioHandler 00145 */ 00146 virtual bool write(ioHandler& handler, 00147 const bool complete = true) const; 00148 00149 /** 00150 * read the object from the given ioHandler 00151 */ 00152 virtual bool read(ioHandler& handler,const bool complete = true); 00153 00154 protected: 00155 /** 00156 * the data of the matrix 00157 */ 00158 T* mem; 00159 00160 /** 00161 * the pointers to the rows of the matrix 00162 */ 00163 T** rows; 00164 00165 /** 00166 * the dimension of the matrix 00167 */ 00168 int dimension; 00169 }; 00170 } 00171 00172 #include "ltiTriMatrix_template.h" 00173 00174 #endif