Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLMath/src/ICLMath/DynVector.h ** 00010 ** Module : ICLMath ** 00011 ** Authors: Christof Elbrechter ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.GPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 00031 #pragma once 00032 00033 #include <ICLMath/DynMatrix.h> 00034 00035 namespace icl{ 00036 namespace math{ 00037 00039 template<class T> 00040 struct DynColVector : public DynMatrix<T>{ 00042 DynColVector(const typename DynMatrix<T>::DynMatrixColumn &column): 00043 DynMatrix<T>(column){} 00044 00046 inline DynColVector():DynMatrix<T>(){}; 00047 00049 inline DynColVector(unsigned int dim,const T &initValue=0) throw (InvalidMatrixDimensionException) : 00050 DynMatrix<T> (1,dim,initValue){} 00051 00053 00056 inline DynColVector(unsigned int dim, T *data, bool deepCopy=true) throw (InvalidMatrixDimensionException) : 00057 DynMatrix<T>(1,dim,data,deepCopy){} 00058 00059 00061 inline DynColVector(unsigned int dim, const T *data) throw (InvalidMatrixDimensionException) : 00062 DynMatrix<T>(1,dim,data){} 00063 00065 inline DynColVector(const DynMatrix<T> &other) throw (InvalidMatrixDimensionException): 00066 DynMatrix<T>(other){ 00067 ICLASSERT_THROW(DynMatrix<T>::cols() == 1, 00068 InvalidMatrixDimensionException("DynColVector(DynMatrix): source matrix has more than one column")); 00069 } 00071 inline DynColVector<T> &operator=(const DynMatrix<T> &other) throw (InvalidMatrixDimensionException){ 00072 DynMatrix<T>::operator=(other); 00073 ICLASSERT_THROW(DynMatrix<T>::cols() == 1, 00074 InvalidMatrixDimensionException("DynColVector = DynMatrix: source matrix has more than one column")); 00075 return *this; 00076 } 00078 00079 inline void setBounds(unsigned int dim, bool holdContent=false, const T &initializer=0) throw (InvalidMatrixDimensionException){ 00080 DynMatrix<T>::setBounds(1,dim,holdContent,initializer); 00081 } 00082 00084 inline void setDim(unsigned int dim, bool holdContent= false, const T &initializer=0) throw (InvalidMatrixDimensionException){ 00085 setBounds(dim,holdContent,initializer); 00086 } 00087 }; 00088 00089 template<class T> 00090 struct DynRowVector : public DynMatrix<T>{ 00092 inline DynRowVector():DynMatrix<T>(){} 00093 00095 inline DynRowVector(unsigned int dim,const T &initValue=0) throw (InvalidMatrixDimensionException) : 00096 DynMatrix<T> (dim,1,initValue){} 00097 00099 00102 inline DynRowVector(unsigned int dim, T *data, bool deepCopy=true) throw (InvalidMatrixDimensionException) : 00103 DynMatrix<T>(dim,1,data,deepCopy){} 00104 00105 00107 inline DynRowVector(unsigned int dim,const T *data) throw (InvalidMatrixDimensionException) : 00108 DynMatrix<T>(dim,1,data){} 00109 00111 inline DynRowVector(const DynMatrix<T> &other) throw (InvalidMatrixDimensionException): 00112 DynMatrix<T>(other){ 00113 ICLASSERT_THROW(DynMatrix<T>::rows() == 1, 00114 InvalidMatrixDimensionException("DynRowVector(DynMatrix): source matrix has more than one rows")); 00115 } 00117 inline DynRowVector<T> &operator=(const DynMatrix<T> &other) throw (InvalidMatrixDimensionException){ 00118 DynMatrix<T>::operator=(other); 00119 ICLASSERT_THROW(DynMatrix<T>::rows() == 1, 00120 InvalidMatrixDimensionException("DynRowVector = DynMatrix: source matrix has more than one rows")); 00121 return *this; 00122 } 00123 00125 00126 inline void setBounds(unsigned int dim, bool holdContent=false, const T &initializer=0) throw (InvalidMatrixDimensionException){ 00127 DynMatrix<T>::setBounds(dim,1,holdContent,initializer); 00128 } 00129 00131 inline void setDim(unsigned int dim, bool holdContent= false, const T &initializer=0) throw (InvalidMatrixDimensionException){ 00132 setBounds(dim,holdContent,initializer); 00133 } 00134 00135 }; 00136 } // namespace math 00137 } 00138