Structural deformable models
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
DMatrix< T > Class Template Reference

#include <DMatrix.h>

Public Types

typedef std::vector< T >::const_iterator const_iterator
 
typedef std::vector< T >::iterator iterator
 
typedef T * TPtr
 
typedef const T * CTPtr
 
typedef DMatrix< T > MT
 
typedef Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > EMT
 

Public Member Functions

 DMatrix (dword _sx=0, dword _sy=0, const T &inival=T())
 
 DMatrix (dword _sx, dword _sy, const T *data)
 
 ~DMatrix ()
 
MTresize (dword _sx, dword _sy, const T &inival=T())
 
MTreshape (dword _sx, dword _sy)
 
void clear ()
 
dword sizeX () const
 
dword sizeY () const
 
dword size () const
 
dword index (dword x, dword y) const
 
T & at (dword x, dword y)
 
const T & at (dword x, dword y) const
 
std::vector< T > & getData ()
 
const std::vector< T > & getData () const
 
bool empty () const
 
MToperator= (const T &rhs)
 
MToperator= (const T *rhs)
 
MToperator+= (const MT &rhs)
 
MToperator-= (const MT &rhs)
 
MToperator*= (const MT &rhs)
 
MToperator/= (const MT &rhs)
 
MToperator+= (const T &rhs)
 
MToperator-= (const T &rhs)
 
MToperator*= (const T &rhs)
 
MToperator/= (const T &rhs)
 
MTmax (const MT &rhs)
 
MTmax (const T &rhs)
 
max () const
 
MTmin (const MT &rhs)
 
MTmin (const T &rhs)
 
min () const
 
MT mulRight (const MT &rhs) const
 
MT mulLeft (const MT &rhs) const
 
MTsetCol (dword col, MT &vec)
 
MTsetCol (dword col, const T &val=1)
 
MTsetRow (dword row, MT &vec)
 
MTsetRange (dword ox, dword oy, const MT &mat)
 
MTgetRange (dword ox, dword oy, MT &mat) const
 
MTsetRow (dword row, const T &val=1)
 
MTsetDiag (MT &vec, int offset=0)
 
MTsetDiag (const T &val=1, int offset=0)
 
MT getDiag (int offset=0)
 
MTsetUpper (const T &val=1, int offset=0)
 
MTsetLower (const T &val=1, int offset=0)
 
MTtranspose ()
 

Protected Attributes

dword sx
 
dword sy
 
std::vector< T > values
 

Friends

std::ostream & operator<< (std::ostream &os, const DMatrix< T > &rhs)
 
std::istream & operator>> (std::istream &is, DMatrix< T > &rhs)
 

Detailed Description

template<class T>
class DMatrix< T >

Small matrix class. First index is colum number. Memory arrangement is row-wise.

Definition at line 13 of file DMatrix.h.

Member Typedef Documentation

template<class T>
typedef std::vector<T>::const_iterator DMatrix< T >::const_iterator

Definition at line 15 of file DMatrix.h.

template<class T>
typedef const T* DMatrix< T >::CTPtr

Definition at line 18 of file DMatrix.h.

template<class T>
typedef Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> DMatrix< T >::EMT

Definition at line 20 of file DMatrix.h.

template<class T>
typedef std::vector<T>::iterator DMatrix< T >::iterator

Definition at line 16 of file DMatrix.h.

template<class T>
typedef DMatrix<T> DMatrix< T >::MT

Definition at line 19 of file DMatrix.h.

template<class T>
typedef T* DMatrix< T >::TPtr

Definition at line 17 of file DMatrix.h.

Constructor & Destructor Documentation

template<class T>
DMatrix< T >::DMatrix ( dword  _sx = 0,
dword  _sy = 0,
const T &  inival = T() 
)
inline

Definition at line 22 of file DMatrix.h.

23  : sx(_sx), sy(_sy), values(_sx*_sy, inival) {}
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
dword sx
Definition: DMatrix.h:306
template<class T>
DMatrix< T >::DMatrix ( dword  _sx,
dword  _sy,
const T *  data 
)
inline

Definition at line 24 of file DMatrix.h.

25  : sx(_sx), sy(_sy), values(_sx*_sy) {
26  operator=(data);
27  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
MT & operator=(const T &rhs)
Definition: DMatrix.h:52
dword sx
Definition: DMatrix.h:306
template<class T>
DMatrix< T >::~DMatrix ( )
inline

Definition at line 28 of file DMatrix.h.

28 {}

Member Function Documentation

template<class T>
T& DMatrix< T >::at ( dword  x,
dword  y 
)
inline
template<class T>
const T& DMatrix< T >::at ( dword  x,
dword  y 
) const
inline

Definition at line 47 of file DMatrix.h.

47 { return values[index(x,y)]; }
std::vector< T > values
Definition: DMatrix.h:307
dword index(dword x, dword y) const
Definition: DMatrix.h:45
template<class T>
void DMatrix< T >::clear ( )
inline

Definition at line 40 of file DMatrix.h.

40 { values.clear(); sx = sy = 0; }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
dword sx
Definition: DMatrix.h:306
template<class T>
bool DMatrix< T >::empty ( ) const
inline

Definition at line 50 of file DMatrix.h.

Referenced by SubStructure::analyseTF(), SubStructure::generateEMDist(), hgPropTF(), and dmutil::invert().

50 { return values.empty(); }
std::vector< T > values
Definition: DMatrix.h:307
template<class T>
std::vector<T>& DMatrix< T >::getData ( )
inline
template<class T>
const std::vector<T>& DMatrix< T >::getData ( ) const
inline

Definition at line 49 of file DMatrix.h.

49 { return values; }
std::vector< T > values
Definition: DMatrix.h:307
template<class T>
MT DMatrix< T >::getDiag ( int  offset = 0)
inline

Definition at line 231 of file DMatrix.h.

Referenced by SubStructure::analyseTF().

231  {
232  int count = offset>=0 ? sx-offset : sy+offset;
233  MT res(1,count);
234  const_iterator vi = values.begin()+( offset>=0 ? offset : -offset*sx);
235  for(iterator ri = res.getData().begin(); count>0;
236  count--, ri++, vi+=sx+1)
237  *ri = *vi;
238  return res;
239  }
DMatrix< T > MT
Definition: DMatrix.h:19
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::getRange ( dword  ox,
dword  oy,
MT mat 
) const
inline

Definition at line 197 of file DMatrix.h.

Referenced by SubStructure::analyseTF(), and dmutil::SVD().

197  {
198  assert(ox<sx && oy<sy);
199  dword width = mat.sx <= sx-ox ? mat.sx : sx-ox;
200  dword height = mat.sy <= sy-oy ? mat.sy : sy-oy;
201  for(dword y = 0; y<height; y++) {
202  const_iterator src = values.begin()+index(ox,oy+y);
203  iterator dst = mat.values.begin() + mat.index(0,y);
204  for(dword x=0; x<width; x++, src++, dst++)
205  *dst = *src;
206  }
207  return mat;
208  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
unsigned long dword
Definition: simpletypes.h:6
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
dword index(dword x, dword y) const
Definition: DMatrix.h:45
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
dword DMatrix< T >::index ( dword  x,
dword  y 
) const
inline

Definition at line 45 of file DMatrix.h.

Referenced by DMatrix< float >::at(), DMatrix< float >::getRange(), and DMatrix< float >::setRange().

45 { return y*sx+x; }
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::max ( const MT rhs)
inline

Definition at line 110 of file DMatrix.h.

Referenced by MStructure::addExpectation(), and MStructure::showStats().

110  {
111  const_iterator ri = rhs.values.begin();
112  for(iterator vi = values.begin(); vi != values.end(); vi++, ri++)
113  if(*vi < *ri) *vi = *ri;
114  return *this;
115  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::max ( const T &  rhs)
inline

Definition at line 116 of file DMatrix.h.

116  {
117  for(iterator vi = values.begin(); vi != values.end(); vi++)
118  if(*vi < rhs) *vi = rhs;
119  return *this;
120  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
T DMatrix< T >::max ( ) const
inline

Definition at line 121 of file DMatrix.h.

121  {
122  assert(sx>0 && sy>0);
123  //T val = std::numeric_limits<T>::min();
124  T val(values[0]);
125  for(const_iterator vi = values.begin(); vi != values.end(); vi++)
126  if(*vi > val) val = *vi;
127  return val;
128  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::min ( const MT rhs)
inline

Definition at line 129 of file DMatrix.h.

Referenced by MStructure::addExpectation(), Model::connectNodes(), Model::selMaskMat(), and MStructure::showStats().

129  {
130  const_iterator ri = rhs.values.begin();
131  for(iterator vi = values.begin(); vi != values.end(); vi++, ri++)
132  if(*vi > *ri) *vi = *ri;
133  return *this;
134  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::min ( const T &  rhs)
inline

Definition at line 135 of file DMatrix.h.

135  {
136  for(iterator vi = values.begin(); vi != values.end(); vi++)
137  if(*vi > rhs) *vi = rhs;
138  return *this;
139  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
T DMatrix< T >::min ( ) const
inline

Definition at line 140 of file DMatrix.h.

140  {
141  assert(sx>0 && sy>0);
142  //T val = std::numeric_limits<T>::max();
143  T val(values[0]);
144  for(const_iterator vi = values.begin(); vi != values.end(); vi++)
145  if(*vi < val) val = *vi;
146  return val;
147  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
dword sx
Definition: DMatrix.h:306
template<class T>
MT DMatrix< T >::mulLeft ( const MT rhs) const
inline

Definition at line 159 of file DMatrix.h.

Referenced by SubStructure::generateEMDist(), and hgPropTF().

159  {
160  return rhs.mulRight(*this);
161  }
template<class T>
MT DMatrix< T >::mulRight ( const MT rhs) const
inline

Definition at line 149 of file DMatrix.h.

Referenced by SubStructure::analyseTF(), MahalSensor::calcValue(), DMatrix< float >::mulLeft(), and dmutil::pseudoInv().

149  {
150  assert(rhs.sy == sx);
151  MT res(rhs.sx, sy, T(0));
152  for(dword rx=0; rx<rhs.sx; rx++)
153  for( dword ly=0; ly<sy; ly++)
154  for(dword ry=0; ry<rhs.sy; ry++)
155  res.at(rx, ly) += at(ry, ly)*rhs.at(rx, ry);
156  return res;
157  }
DMatrix< T > MT
Definition: DMatrix.h:19
dword sy
Definition: DMatrix.h:306
unsigned long dword
Definition: simpletypes.h:6
T & at(dword x, dword y)
Definition: DMatrix.h:46
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::operator*= ( const MT rhs)
inline

Definition at line 76 of file DMatrix.h.

76  {
77  const_iterator ri = rhs.values.begin();
78  for(iterator vi = values.begin(); vi != values.end(); vi++, ri++)
79  *vi *= *ri;
80  return *this;
81  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator*= ( const T &  rhs)
inline

Definition at line 99 of file DMatrix.h.

99  {
100  for(iterator vi = values.begin(); vi != values.end(); vi++)
101  *vi *= rhs;
102  return *this;
103  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator+= ( const MT rhs)
inline

Definition at line 64 of file DMatrix.h.

64  {
65  const_iterator ri = rhs.values.begin();
66  for(iterator vi = values.begin(); vi != values.end(); vi++, ri++)
67  *vi += *ri;
68  return *this;
69  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator+= ( const T &  rhs)
inline

Definition at line 89 of file DMatrix.h.

89  {
90  for(iterator vi = values.begin(); vi != values.end(); vi++)
91  *vi += rhs;
92  return *this;
93  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator-= ( const MT rhs)
inline

Definition at line 70 of file DMatrix.h.

70  {
71  const_iterator ri = rhs.values.begin();
72  for(iterator vi = values.begin(); vi != values.end(); vi++, ri++)
73  *vi -= *ri;
74  return *this;
75  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator-= ( const T &  rhs)
inline

Definition at line 94 of file DMatrix.h.

94  {
95  for(iterator vi = values.begin(); vi != values.end(); vi++)
96  *vi -= rhs;
97  return *this;
98  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator/= ( const MT rhs)
inline

Definition at line 82 of file DMatrix.h.

82  {
83  const_iterator ri = rhs.values.begin();
84  for(iterator vi = values.begin(); vi != values.end(); vi++, ri++)
85  *vi /= *ri;
86  return *this;
87  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator/= ( const T &  rhs)
inline

Definition at line 104 of file DMatrix.h.

104  {
105  for(iterator vi = values.begin(); vi != values.end(); vi++)
106  *vi /= rhs;
107  return *this;
108  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator= ( const T &  rhs)
inline

Definition at line 52 of file DMatrix.h.

Referenced by DMatrix< float >::DMatrix().

52  {
53  for(iterator vi = values.begin(); vi != values.end(); vi++)
54  *vi += rhs;
55  return *this;
56  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::operator= ( const T *  rhs)
inline

Definition at line 58 of file DMatrix.h.

58  {
59  for(iterator vi = values.begin(); vi != values.end(); vi++, rhs++)
60  *vi += *rhs;
61  return *this;
62  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
template<class T>
MT& DMatrix< T >::reshape ( dword  _sx,
dword  _sy 
)
inline

Definition at line 35 of file DMatrix.h.

Referenced by DMatrix< float >::transpose().

35  {
36  assert(sx*sy == _sx*_sy);
37  sx = _sx; sy = _sy;
38  return *this;
39  }
dword sy
Definition: DMatrix.h:306
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::resize ( dword  _sx,
dword  _sy,
const T &  inival = T() 
)
inline

Definition at line 30 of file DMatrix.h.

Referenced by SubStructure::analyseTF(), and dmutil::SVD().

30  {
31  sx = _sx; sy = _sy;
32  values.resize(sx*sy, inival);
33  return *this;
34  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setCol ( dword  col,
MT vec 
)
inline

Definition at line 163 of file DMatrix.h.

Referenced by Model::selMaskMat(), and dmutil::SVD().

163  {
164  assert(sy == vec.getData().size());
165  iterator vi = values.begin()+col;
166  for(const_iterator ri = vec.getData().begin();
167  ri != vec.getData().end(); ri++, vi+=sx)
168  *vi = *ri;
169  return *this;
170  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setCol ( dword  col,
const T &  val = 1 
)
inline

Definition at line 171 of file DMatrix.h.

171  {
172  iterator vi = values.begin()+col;
173  for(dword i=0; i<sy; i++, vi+=sx)
174  *vi = val;
175  return *this;
176  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
unsigned long dword
Definition: simpletypes.h:6
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setDiag ( MT vec,
int  offset = 0 
)
inline

Definition at line 215 of file DMatrix.h.

215  {
216  int count = offset>=0 ? sx-offset : sy+offset;
217  assert( count <= vec.getData().size() );
218  iterator vi = values.begin() + ( offset>=0 ? offset : -offset*sx);
219  for(const_iterator ri = vec.getData().begin(); count>0;
220  count--, ri++, vi+=sx+1)
221  *vi = *ri;
222  return *this;
223  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setDiag ( const T &  val = 1,
int  offset = 0 
)
inline

Definition at line 224 of file DMatrix.h.

224  {
225  int count = offset>=0 ? sx-offset : sy+offset;
226  iterator vi = values.begin() + ( offset>=0 ? offset : -offset*sx);
227  for(; count>0; count--, vi+=(sx+1))
228  *vi = val;
229  return *this;
230  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setLower ( const T &  val = 1,
int  offset = 0 
)
inline

Definition at line 250 of file DMatrix.h.

Referenced by Model::adjMat(), and Model::connectNodes().

250  {
251  int i=0,j=0;
252  for(iterator mi = values.begin();
253  mi != values.end(); mi++, i++) {
254  if(i==(int)sx) { j++; i=0; }
255  if(i-j<=offset) *mi = val;
256  }
257  return *this;
258  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setRange ( dword  ox,
dword  oy,
const MT mat 
)
inline

Definition at line 185 of file DMatrix.h.

Referenced by SubStructure::analyseTF(), MStructure::buildAllStats(), dmutil::expand(), hgPropTF(), dmutil::horizCat(), MStructure::showStats(), and dmutil::vertCat().

185  {
186  assert(ox<sx && oy<sy);
187  dword width = mat.sx <= sx-ox ? mat.sx : sx-ox;
188  dword height = mat.sy <= sy-oy ? mat.sy : sy-oy;
189  for(dword y = 0; y<height; y++) {
190  iterator dst = values.begin()+index(ox,oy+y);
191  const_iterator src = mat.values.begin() + mat.index(0,y);
192  for(dword x=0; x<width; x++, src++, dst++)
193  *dst = *src;
194  }
195  return *this;
196  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
unsigned long dword
Definition: simpletypes.h:6
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
dword index(dword x, dword y) const
Definition: DMatrix.h:45
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setRow ( dword  row,
MT vec 
)
inline

Definition at line 177 of file DMatrix.h.

Referenced by Model::selMaskMat().

177  {
178  assert(sx == vec.getData().size());
179  iterator vi = values.begin()+(row*sx);
180  for(const_iterator ri = vec.getData().begin();
181  ri != vec.getData().end(); ri++, vi++)
182  *vi = *ri;
183  return *this;
184  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setRow ( dword  row,
const T &  val = 1 
)
inline

Definition at line 209 of file DMatrix.h.

209  {
210  iterator vi = values.begin()+(row*sx);
211  for(dword i=0; i<sx; i++, vi++)
212  *vi = val;
213  return *this;
214  }
std::vector< T > values
Definition: DMatrix.h:307
unsigned long dword
Definition: simpletypes.h:6
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
MT& DMatrix< T >::setUpper ( const T &  val = 1,
int  offset = 0 
)
inline

Definition at line 241 of file DMatrix.h.

241  {
242  int i=0,j=0;
243  for(iterator mi = values.begin();
244  mi != values.end(); mi++, i++) {
245  if(i==sx) { j++; i=0; }
246  if(i-j>=offset) *mi = val;
247  }
248  return *this;
249  }
std::vector< T > values
Definition: DMatrix.h:307
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306
template<class T>
dword DMatrix< T >::size ( ) const
inline

Definition at line 44 of file DMatrix.h.

Referenced by StructTable::adjustByAvgDir(), and dmutil::makeDiag().

44 { return values.size(); }
std::vector< T > values
Definition: DMatrix.h:307
template<class T>
dword DMatrix< T >::sizeX ( ) const
inline
template<class T>
dword DMatrix< T >::sizeY ( ) const
inline
template<class T>
MT& DMatrix< T >::transpose ( )
inline

Definition at line 260 of file DMatrix.h.

Referenced by Model::adjMat(), SubStructure::analyseTF(), MahalSensor::calcValue(), and dmutil::pseudoInv().

260  {
261  if(sx*sy>1) {
262  if(sx==sy)
263  for(dword j=0; j<sy-1; j++)
264  for(dword i = j+1; i<sx; i++)
265  {
266  T& a = at(i,j);
267  T& b = at(j,i);
268  T dummy = a; a = b; b = dummy;
269  }
270  else if(sx == 1 || sy == 1) reshape(sy, sx);
271  else {
272  MT tmp(*this);
273  reshape(sy,sx);
274  for(dword j=0; j<sy; j++)
275  for(dword i = 0; i<sx; i++)
276  {
277  at(i,j) = tmp.at(j,i);
278  }
279  }
280  }
281  return *this;
282  }
DMatrix< T > MT
Definition: DMatrix.h:19
MT & reshape(dword _sx, dword _sy)
Definition: DMatrix.h:35
dword sy
Definition: DMatrix.h:306
unsigned long dword
Definition: simpletypes.h:6
T & at(dword x, dword y)
Definition: DMatrix.h:46
dword sx
Definition: DMatrix.h:306

Friends And Related Function Documentation

template<class T>
std::ostream& operator<< ( std::ostream &  os,
const DMatrix< T > &  rhs 
)
friend

Definition at line 284 of file DMatrix.h.

284  {
285  os << rhs.sx << " " << rhs.sy;
286  dword cc=0;
287  for(const_iterator vi = rhs.values.begin();
288  vi != rhs.values.end(); vi++, cc--) {
289  if(!cc) { cc = rhs.sx; os << std::endl; }
290  else os << " ";
291  os << *vi;
292  }
293  os << std::endl;
294  return os;
295  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
unsigned long dword
Definition: simpletypes.h:6
std::vector< T >::const_iterator const_iterator
Definition: DMatrix.h:15
dword sx
Definition: DMatrix.h:306
template<class T>
std::istream& operator>> ( std::istream &  is,
DMatrix< T > &  rhs 
)
friend

Definition at line 296 of file DMatrix.h.

296  {
297  is >> rhs.sx; is >> rhs.sy;
298  rhs.resize(rhs.sx, rhs.sy);
299  for(iterator vi = rhs.values.begin();
300  vi != rhs.values.end(); vi++)
301  is >> *vi;
302  return is;
303  }
std::vector< T > values
Definition: DMatrix.h:307
dword sy
Definition: DMatrix.h:306
MT & resize(dword _sx, dword _sy, const T &inival=T())
Definition: DMatrix.h:30
std::vector< T >::iterator iterator
Definition: DMatrix.h:16
dword sx
Definition: DMatrix.h:306

Member Data Documentation

template<class T>
dword DMatrix< T >::sx
protected
template<class T>
dword DMatrix< T >::sy
protected
template<class T>
std::vector<T> DMatrix< T >::values
protected

The documentation for this class was generated from the following file: