Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Matrix3x3.cpp
1 /* This file is part of the BIAS library (Basic ImageAlgorithmS).
2 
3  Copyright (C) 2003-2009 (see file CONTACT for details)
4  Multimediale Systeme der Informationsverarbeitung
5  Institut fuer Informatik
6  Christian-Albrechts-Universitaet Kiel
7 
8  BIAS is free software; you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation; either version 2.1 of the License, or
11  (at your option) any later version.
12 
13  BIAS is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with BIAS; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/
21 #include <Base/Common/BIASpragma.hh>
22 
23 #include <Base/Common/CompareFloatingPoint.hh>
24 #include "Matrix3x3.hh"
25 
26 #include <Base/Math/Matrix.hh>
27 #include <Base/Math/Matrix3x4.hh>
28 
29 #include <fstream>
30 
31 using namespace BIAS;
32 using namespace std;
33 
34 
35 /*template<class T>
36  Matrix3x3<T>::Matrix3x3(const std::string & s)
37  {
38  BEXCEPTION("unfinished")
39  }*/
40 
41 
42 namespace BIAS{
43 
44 template<class T>
46 Matrix3x3(const T a0, const T a1, const T a2,
47  const T a3, const T a4, const T a5,
48  const T a6, const T a7, const T a8)
49 {
50  Data_[0]=a0; Data_[1]=a1; Data_[2]=a2;
51  Data_[3]=a3; Data_[4]=a4; Data_[5]=a5;
52  Data_[6]=a6; Data_[7]=a7; Data_[8]=a8;
53 }
54 
55 
56 template<class T>
59 {
60  SetZero();
61  switch (i) {
62  case MatrixZero:
63  return;
64  case MatrixIdentity:
65  this->Data_[0] = this->Data_[4] = this->Data_[8] =T(1);
66  return;
67  default:
68  BIASERR("undefined MatrixInitType");
69  BIASABORT;
70  }
71 }
72 
73 
74 template<class T>
77 {
78  memcpy((void *)Data_, (const void *)A.Data_, 9*sizeof(T));
79 }
80 
81 
82 template<class T>
84 Matrix3x3(const Matrix<T>& mat)
85 {
86  if ((mat.num_rows() != 3) || (mat.num_cols() != 3)) {
87  BIASERR("wrong matrix size "<<mat.num_rows()<<"x"
88  << mat.num_cols());
89  BIASABORT;
90  }
91  memcpy((void *)Data_, (void *)mat.GetData(), 9*sizeof(T));
92 }
93 
94 
95 template<class T>
98 {
99  if ((mat.num_rows() != 3) || (mat.num_cols() != 3)) {
100  BIASERR("wrong matrix size "<<mat.num_rows()<<"x"
101  << mat.num_cols());
102  BIASABORT;
103  }
104  Data_[0] = mat[0][0];
105  Data_[1] = mat[0][1];
106  Data_[2] = mat[0][2];
107  Data_[3] = mat[1][0];
108  Data_[4] = mat[1][1];
109  Data_[5] = mat[1][2];
110  Data_[6] = mat[2][0];
111  Data_[7] = mat[2][1];
112  Data_[8] = mat[2][2];
113 }
114 
115 
116 template<class T>
119 {}
120 
121 
122 template<class T>
125 {
126  for (int i=0; i<9; i++)
127  Data_[i] += arg.Data_[i];
128  return *this;
129 }
130 
131 
132 template<class T>
135 {
136  for (int i=0; i<9; i++)
137  Data_[i] -= arg.Data_[i];
138  return *this;
139 }
140 
141 
142 template <class T>
144 operator*=(const T &scalar)
145 {
146  register T *src = this->GetData();
147  for (int i=0; i<9; i++)
148  src[i] *= scalar;
149  return *this;
150 }
151 
152 
153 template <class T>
155 operator/=(const T &scalar)
156 {
157  BIASASSERT(!Equal(scalar, (T)0.0));
158  register T *src = this->GetData();
159  for (int i=0; i<9; i++)
160  src[i] /= scalar;
161  return *this;
162 }
163 
164 
165 template<class T>
167 Transpose() const
168 {
169  Matrix3x3<T> ret;
170 
171  T *retd = ret.GetData();
172  const T *thisd = Data_;
173  retd[0] = thisd[0];
174  retd[1] = thisd[3];
175  retd[2] = thisd[6];
176 
177  retd[3] = thisd[1];
178  retd[4] = thisd[4];
179  retd[5] = thisd[7];
180 
181  retd[6] = thisd[2];
182  retd[7] = thisd[5];
183  retd[8] = thisd[8];
184  return ret;
185 }
186 
187 
188 template<class T>
189 void Matrix3x3<T>::
191 {
192  BIASASSERT(vec.size() == 9 );
193  // fill the matrix rowwise with the first 9 elements of the vector
194  // example:
195  // 1 2 3 4 5 6 7 8 9
196  // -->
197  // 1 2 3
198  // 4 5 6
199  // 7 8 9
200  for (int i=0; i<9; i++) {
201  Data_[i] = vec[i];
202  }
203 }
204 
205 
206 template<class T>
207 void Matrix3x3<T>::
209  const BIAS::Vector3<T> & v1,
210  const BIAS::Vector3<T> & v2 )
211 {
212  Data_[0] = v0[0];
213  Data_[1] = v1[0];
214  Data_[2] = v2[0];
215  Data_[3] = v0[1];
216  Data_[4] = v1[1];
217  Data_[5] = v2[1];
218  Data_[6] = v0[2];
219  Data_[7] = v1[2];
220  Data_[8] = v2[2];
221 }
222 
223 
224 template<class T>
225 void Matrix3x3<T>::
227  const BIAS::Vector3<T> & v1,
228  const BIAS::Vector3<T> & v2 )
229 {
230  Data_[0] = v0[0];
231  Data_[1] = v0[1];
232  Data_[2] = v0[2];
233  Data_[3] = v1[0];
234  Data_[4] = v1[1];
235  Data_[5] = v1[2];
236  Data_[6] = v2[0];
237  Data_[7] = v2[1];
238  Data_[8] = v2[2];
239 }
240 
241 
242 template<>
244 SetAsCrossProductMatrix(const unsigned int & /*x*/,
245  const unsigned int & /*y*/,
246  const unsigned int & /*z*/) {
247  BIASERR("not implemented because minus does not make sense for "
248  "unsigned type");
249  BIASABORT;
250 }
251 
252 template <class T>
253 void Matrix3x3<T>::
254 SetAsCrossProductMatrix(const T &x, const T &y, const T &z)
255 {
256  T *mat=this->GetData();
257  mat[0]=mat[4]=mat[8]=0;
258  mat[1]= -z; mat[2]= y;
259  mat[3]= z; mat[5]=-x;
260  mat[6]= -y; mat[7]= x;
261 }
262 
263 
264 template<>
267  BIASERR("not implemented because minus does not make sense for "
268  "unsigned type");
269  BIASABORT;
270 }
271 
272 
273 template <class T>
274 void Matrix3x3<T>::
276 {
277  T *mat=this->GetData();
278  mat[0]=mat[4]=mat[8]=0;
279  mat[1]=-vec[2]; mat[2]=vec[1];
280  mat[3]= vec[2]; mat[5]=-vec[0];
281  mat[6]= -vec[1]; mat[7]=vec[0];
282 }
283 
284 
285 template<class T>
286 void Matrix3x3<T>::
287 GetRow(const unsigned int row, Vector3<T>& v) const
288 {
289  BIASASSERT(row<3);// this has only 3 rows[0,1,2]
290  const T* p =Data_ + 3*row;
291  v[0]=*p++;
292  v[1]=*p++;
293  v[2]=*p;
294 }
295 
296 
297 template<class T>
298 void Matrix3x3<T>::
299 GetColumn(const unsigned int col, BIAS::Vector3<T>& v) const
300 {
301  BIASASSERT(col<3);// this has only 3 cols[0,1,2]
302  const T* p =Data_ + col;
303  v[0] = p[0];
304  v[1] = p[3];
305  v[2] = p[6];
306 }
307 
308 
309 template<class T>
310 void Matrix3x3<T>::
311 SetRow(const unsigned int row, const Vector3<T>& r)
312 {
313  BIASASSERT(row<3);// this has only 3 cols[0,1,2]
314  T* p = Data_ + 3*row;
315  p[0] = r[0];
316  p[1] = r[1];
317  p[2] = r[2];
318 }
319 
320 
321 template<class T>
322 void Matrix3x3<T>::
323 SetColumn(const unsigned int col, const Vector3<T>& c)
324 {
325  BIASASSERT(col<3);// this has only 3 cols[0,1,2]
326  T* p = Data_ + col;
327  p[0] = c[0];
328  p[3] = c[1];
329  p[6] = c[2];
330 }
331 
332 #ifdef WIN32
333 template<> BIASMathBase_EXPORT
334 unsigned int Matrix3x3<unsigned int>::
335 NormL1() const
336 {
337  unsigned int result = 0;
338  for (int i=0; i<9; i++){
339  result += Data_[i];
340  }
341  return result;
342 }
343 #endif
344 
345 template<class T>
348 {
349  double t4 = (*this)[0][0]*(*this)[1][1];
350  double t6 = (*this)[0][0]*(*this)[1][2];
351  double t8 = (*this)[0][1]*(*this)[1][0];
352  double t10 = (*this)[0][2]*(*this)[1][0];
353  double t12 = (*this)[0][1]*(*this)[2][0];
354  double t14 = (*this)[0][2]*(*this)[2][0];
355  return T((t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+
356  t10*(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]));
357 }
358 
359 
360 template<>
363 {
364  BIASERR("not implemented because minus does not make sense for "
365  "unsigned type");
366  BIASBREAK;
367  return -1;
368 }
369 
370 
371 template<class T>
372 int Matrix3x3<T>::
374 {
375  int res=0;
376  BIASASSERT(x.GetData()!=Data_);
377  // following lines have been produced by Maple
378  const double t4 = (*this)[0][0]*(*this)[1][1];
379  const double t6 = (*this)[0][0]*(*this)[1][2];
380  const double t8 = (*this)[0][1]*(*this)[1][0];
381  const double t10 = (*this)[0][2]*(*this)[1][0];
382  const double t12 = (*this)[0][1]*(*this)[2][0];
383  const double t14 = (*this)[0][2]*(*this)[2][0];
384 
385  const double det=(t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+t10
386  *(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]);
387  // matrices with zero determinant are not invertible
388  if (det==0.0)
389  return -1;
390 
391  const double t17 = 1.0/det;
392 
393  x[0][0] = T(((*this)[1][1]*(*this)[2][2]-(*this)[1][2]*(*this)[2][1])*t17);
394  x[0][1] = T(-((*this)[0][1]*(*this)[2][2]-(*this)[0][2]*(*this)[2][1])*t17);
395  x[0][2] = T(-(-(*this)[0][1]*(*this)[1][2]+(*this)[0][2]*(*this)[1][1])*t17);
396  x[1][0] = T(-((*this)[1][0]*(*this)[2][2]-(*this)[1][2]*(*this)[2][0])*t17);
397  x[1][1] = T(((*this)[0][0]*(*this)[2][2]-t14)*t17);
398  x[1][2] = T(-(t6-t10)*t17);
399  x[2][0] = T(((*this)[1][0]*(*this)[2][1]-(*this)[1][1]*(*this)[2][0])*t17);
400  x[2][1] = T(-((*this)[0][0]*(*this)[2][1]-t12)*t17);
401  x[2][2] = T((t4-t8)*t17);
402 
403  return res;
404 }
405 
406 
407 template<>
410 {
411  BIASERR("not implemented because minus does not make sense for "
412  "unsigned type");
413  BIASBREAK;
414  return -1;
415 }
416 
417 
418 template<class T>
419 int Matrix3x3<T>::
421 {
422  int res=0;
423 
424  // following lines have been produced by Maple
425  const double t4 = (*this)[0][0]*(*this)[1][1];
426  const double t6 = (*this)[0][0]*(*this)[1][2];
427  const double t8 = (*this)[0][1]*(*this)[1][0];
428  const double t10 = (*this)[0][2]*(*this)[1][0];
429  const double t12 = (*this)[0][1]*(*this)[2][0];
430  const double t14 = (*this)[0][2]*(*this)[2][0];
431 
432  const double det=(t4*(*this)[2][2]-t6*(*this)[2][1]-t8*(*this)[2][2]+t10
433  *(*this)[2][1]+t12*(*this)[1][2]-t14*(*this)[1][1]);
434  // matrices with zero determinante ar not invertible
435  if (det==0.0) return -1;
436 
437  const double t17 = 1.0/det;
438 
439  T tmp[9];
440 
441  tmp[0] = T(((*this)[1][1]*(*this)[2][2]-(*this)[1][2]*(*this)[2][1])*t17);
442  tmp[1] = T(-((*this)[0][1]*(*this)[2][2]-(*this)[0][2]*(*this)[2][1])*t17);
443  tmp[2] = T(-(-(*this)[0][1]*(*this)[1][2]+(*this)[0][2]*(*this)[1][1])*t17);
444  tmp[3] = T(-((*this)[1][0]*(*this)[2][2]-(*this)[1][2]*(*this)[2][0])*t17);
445  tmp[4] = T(((*this)[0][0]*(*this)[2][2]-t14)*t17);
446  tmp[5] = T(-(t6-t10)*t17);
447  tmp[6] = T(((*this)[1][0]*(*this)[2][1]-(*this)[1][1]*(*this)[2][0])*t17);
448  tmp[7] = T(-((*this)[0][0]*(*this)[2][1]-t12)*t17);
449  tmp[8] = T((t4-t8)*t17);
450 
451  memcpy((void*)(Data_), (void*)tmp, 9*sizeof(T));
452 
453  return res;
454 }
455 
456 
457 template <class T>
458 void Matrix3x3<T>::
459 Mult(const Matrix3x4<T> &argmat, Matrix3x4<T> &destmat) const
460 {
461  //
462  // direct access using fixed indicies with matrix order:
463  // 0 1 2
464  // 3 4 5
465  // 6 7 8
466  // oder 3x4
467  // 0 1 2 3
468  // 4 5 6 7
469  // 8 9 10 11
470  T *destP = (T*) (destmat.GetData());
471  const T *argP = (T*)(argmat.GetData());
472  const register T *matP = this->GetData();
473  // does not work for in place multiplication
474  BIASASSERT(matP!=argP);
475  BIASASSERT(matP!=destP);
476 
477  destP[0] =
478  matP[0] * argP[0] + matP[1] * argP[4] + matP[2] * argP[8];
479  destP[1] =
480  matP[0] * argP[1] + matP[1] * argP[5] + matP[2] * argP[9];
481  destP[2] =
482  matP[0] * argP[2] + matP[1] * argP[6] + matP[2] * argP[10];
483  destP[3] =
484  matP[0] * argP[3] + matP[1] * argP[7] + matP[2] * argP[11];
485 
486  destP[4] =
487  matP[3] * argP[0] + matP[4] * argP[4] + matP[5] * argP[8];
488  destP[5] =
489  matP[3] * argP[1] + matP[4] * argP[5] + matP[5] * argP[9];
490  destP[6] =
491  matP[3] * argP[2] + matP[4] * argP[6] + matP[5] * argP[10];
492  destP[7] =
493  matP[3] * argP[3] + matP[4] * argP[7] + matP[5] * argP[11];
494 
495  destP[8] =
496  matP[6] * argP[0] + matP[7] * argP[4] + matP[8] * argP[8];
497  destP[9] =
498  matP[6] * argP[1] + matP[7] * argP[5] + matP[8] * argP[9];
499  destP[10] =
500  matP[6] * argP[2] + matP[7] * argP[6] + matP[8] * argP[10];
501  destP[11] =
502  matP[6] * argP[3] + matP[7] * argP[7] + matP[8] * argP[11];
503 }
504 
505 
506 template <class T>
507 bool Matrix3x3<T>::
508 IsZero(T eps) const
509 {
510  for (int i=0; i<9; i++)
511  if (!Equal(Data_[i], (T)0.0, eps)) return false;
512  return true;
513 }
514 
515 
516 template <class T>
517 bool Matrix3x3<T>::
518 IsIdentity(T eps) const
519 {
520  if (!Equal(Data_[0], (T)1.0, eps)) return false;
521  if (!Equal(Data_[1], (T)0.0, eps)) return false;
522  if (!Equal(Data_[2], (T)0.0, eps)) return false;
523  if (!Equal(Data_[3], (T)0.0, eps)) return false;
524  if (!Equal(Data_[4], (T)1.0, eps)) return false;
525  if (!Equal(Data_[5], (T)0.0, eps)) return false;
526  if (!Equal(Data_[6], (T)0.0, eps)) return false;
527  if (!Equal(Data_[7], (T)0.0, eps)) return false;
528  if (!Equal(Data_[8], (T)1.0, eps)) return false;
529 
530  return true;
531 }
532 
533 
534 template<class T>
535 bool Matrix3x3<T>::
536 operator==(const Matrix3x3<T>& arg) const
537 {
538  for (int i=0; i<9; i++)
539  if (!Equal(Data_[i], arg.Data_[i])) return false;
540  return true;
541 }
542 
543 
544 template<class T>
545 bool Matrix3x3<T>::
546 Load(const std::string & filename)
547 {
548  std::ifstream fs( filename.c_str() );
549  if (!fs.good()) {
550  return false;
551  }
552 
553  fs>>(*this);
554  if (!fs.good()) return false;
555  fs.close();
556 
557  return true;
558 }
559 
560 
561 template<class T>
562 bool Matrix3x3<T>::
563 Save(const std::string & filename) const
564 {
565  std::ofstream fs( filename.c_str() );
566  if (!fs.good()) {
567  return false;
568  }
569  fs<<(*this);
570  if (!fs.good()) {
571  fs.close(); return false; }
572  fs.close();
573 
574  return true;
575 }
576 
577 
578 template<class T>
581 {
582  T greatest = 0;
583  for (int i=0; i<9; i++)
584  if ( (Data_[i])*(Data_[i]) > greatest*greatest )
585  greatest = Data_[i];
586  (*this) /= greatest;
587  return greatest;
588 }
589 
590 
591 template<class T>
592 void Matrix3x3<T>::
594 {
595  for (int r=0; r<3; r++){
596  for (int c=r; c<3; c++){
597  (*this)[c][r] = (*this)[r][c] =
598  T(((*this)[c][r] + (*this)[r][c]) / 2.0);
599  }
600  }
601 }
602 
603 
604 template<class T>
606 GetMax() const
607 {
608  register const T *d = this->GetData();
609  T max = *d;
610  if (d[1]>max) max=d[1];
611  if (d[2]>max) max=d[2];
612  if (d[3]>max) max=d[3];
613  if (d[4]>max) max=d[4];
614  if (d[5]>max) max=d[5];
615  if (d[6]>max) max=d[6];
616  if (d[7]>max) max=d[7];
617  if (d[8]>max) max=d[8];
618  return max;
619 }
620 
621 
622 template<class T>
624 GetMin() const
625 {
626  register const T *d = this->GetData();
627  T min = *d;
628  if (d[1]<min) min=d[1];
629  if (d[2]<min) min=d[2];
630  if (d[3]<min) min=d[3];
631  if (d[4]<min) min=d[4];
632  if (d[5]<min) min=d[5];
633  if (d[6]<min) min=d[6];
634  if (d[7]<min) min=d[7];
635  if (d[8]<min) min=d[8];
636  return min;
637 }
638 
639 
640 template<class T>
641 void Matrix3x3<T>::
642 GetMaxMin(T& max, T& min) const
643 {
644  register const T *d = this->GetData();
645  max = min = *d;
646 
647  if (d[1]>max) max=d[1];
648  if (d[2]>max) max=d[2];
649  if (d[3]>max) max=d[3];
650  if (d[4]>max) max=d[4];
651  if (d[5]>max) max=d[5];
652  if (d[6]>max) max=d[6];
653  if (d[7]>max) max=d[7];
654  if (d[8]>max) max=d[8];
655 
656  if (d[1]<min) min=d[1];
657  if (d[2]<min) min=d[2];
658  if (d[3]<min) min=d[3];
659  if (d[4]<min) min=d[4];
660  if (d[5]<min) min=d[5];
661  if (d[6]<min) min=d[6];
662  if (d[7]<min) min=d[7];
663  if (d[8]<min) min=d[8];
664 }
665 
666 
667 template <class T>
668 void Matrix3x3<T>::
669 GetAbsMaxMin(T& max, T& min) const
670 {
671  BIASERR("does not exist for this storaget type");
672  BIASABORT;
673 }
674 
675 
676 template<>
678 GetAbsMaxMin(double& max, double& min) const
679 {
680  max = min = fabs( Data_[0] );
681  for(int i=0; i<9; i++) {
682  double ad = fabs(Data_[i]);
683  if (ad<min) min = ad;
684  else if (ad>max) max = ad;
685  }
686 }
687 
688 
689 template<>
691 GetAbsMaxMin(float& max, float& min) const
692 {
693  max = min = fabs( Data_[0] );
694  for(int i=0; i<9; i++) {
695  float ad = fabs(Data_[i]);
696  if (ad<min) min = ad;
697  else if (ad>max) max = ad;
698  }
699 }
700 
701 
702 template<class T>
705 {
706  memcpy((void *)Data_, (const void *)mat.Data_, 9*sizeof(T));
707  return *this;
708 }
709 
710 } //end namespace BIAS
711 
712 ////////////////////////////////////////////////////////////////
713 // non class functions
714 ////////////////////////////////////////////////////////////////
715 
716 template <class T>
717 std::istream& BIAS::operator>>(std::istream &s, Matrix3x3<T> &A)
718 {
719  Matrix<T> tmp;
720 
721  s >> tmp;
722 
723  if (tmp.num_cols()!=3 || tmp.num_rows()!=3) {
724  s.setstate(std::ios::badbit | std::ios::failbit);
725  return s;
726  }
727 
728  A = Matrix3x3<T>(tmp);
729 
730  return s;
731 }
732 
733 template <class T>
734 std::ostream& BIAS::operator<<(std::ostream &s, const Matrix3x3<T> &A)
735 {
736  Matrix<T> tmp = Matrix<T>(A);
737  // use stream operator from Matrix for compatibility
738  s << tmp;
739  return s;
740 }
741 
742 
743 
744 #define INST(type) \
745  template class BIASMathBase_EXPORT BIAS::Matrix3x3<type>; \
746  template BIASMathBase_EXPORT ostream& BIAS::operator<<<type>(ostream& os, const Matrix3x3<type>& mat); \
747  template BIASMathBase_EXPORT istream& BIAS::operator>><type>(istream& is, Matrix3x3<type>& mat);
748 
749 INST(unsigned char)
750 INST(char)
751 INST(float)
752 INST(short)
753 INST(unsigned short)
754 INST(long int)
755 INST(int)
756 INST(unsigned int)
757 INST(double)
void GetRow(const unsigned int row, Vector3< T > &r) const
extract one row (&#39;Zeile&#39;) from ths matrix (for convenience)
Definition: Matrix3x3.cpp:287
void SetRow(const unsigned int row, const Vector3< T > &r)
Definition: Matrix3x3.cpp:311
MatrixInitType
can be passed to matrix constructors to init the matrix with the most often used values ...
Definition: Matrix.hh:59
void MakeSymmetric()
Definition: Matrix3x3.cpp:593
Subscript num_cols() const
Definition: cmat.h:320
void SetColumn(const unsigned int col, const Vector3< T > &c)
Definition: Matrix3x3.cpp:323
void GetAbsMaxMin(T &max, T &min) const
Definition: Matrix3x3.cpp:669
virtual ~Matrix3x3()
destructor
Definition: Matrix3x3.cpp:118
T NormL1() const
Definition: Matrix3x3.hh:457
void GetColumn(const unsigned int col, Vector3< T > &r) const
extract one column (&#39;Spalte&#39;) from this matrix (for convenience)
Definition: Matrix3x3.cpp:299
bool operator==(const Matrix3x3< T > &arg) const
Definition: Matrix3x3.cpp:536
bool IsIdentity(const T eps=std::numeric_limits< T >::epsilon()) const
Definition: Matrix3x3.cpp:518
Matrix3x3< T > & operator/=(const T &arg)
Definition: Matrix3x3.cpp:155
T GetMax() const
Definition: Matrix3x3.cpp:606
bool Save(const std::string &fname) const
Definition: Matrix3x3.cpp:563
T GetMin() const
Definition: Matrix3x3.cpp:624
void Mult(const Vector3< T > &argvec, Vector3< T > &destvec) const
matrix - vector multiplicate this matrix with Vector3, storing the result in destvec calculates: dest...
Definition: Matrix3x3.hh:302
Matrix3x3< T > & operator-=(const Matrix3x3< T > &arg)
Definition: Matrix3x3.cpp:134
void SetFromRowVectors(const BIAS::Vector3< T > &v0, const BIAS::Vector3< T > &v1, const BIAS::Vector3< T > &v2)
set this matrix from 3 vectors, each representating a row
Definition: Matrix3x3.cpp:226
int GetInverse(Matrix3x3< T > &inv) const
Matrix inversion: inverts this and stores resulty in argument inv.
Definition: Matrix3x3.cpp:373
INST(unsigned char)
bool IsZero(const T eps=std::numeric_limits< T >::epsilon()) const
Definition: Matrix3x3.cpp:508
bool Load(const std::string &fname)
Definition: Matrix3x3.cpp:546
T * GetData()
get the pointer to the data array of the matrix (for faster direct memeory access) ...
Definition: Matrix.hh:185
is a &#39;fixed size&#39; quadratic matrix of dim.
Definition: Matrix.hh:54
void SetFromVector(const TNT::Vector< T > &vec)
sets the diagonalelements of this 3x3 Matrix rowwise with the values of the 9 (x1) vector ...
Definition: Matrix3x3.cpp:190
Matrix3x3< T > & operator*=(const Matrix3x3< T > &arg)
woelk 11/2007 (c) www.vision-n.de
Definition: Matrix3x3.hh:143
class Vector3 contains a Vector of fixed dim.
Definition: Matrix.hh:53
bool Equal(const T left, const T right, const T eps)
comparison function for floating point values See http://www.boost.org/libs/test/doc/components/test_...
matrix class with arbitrary size, indexing is row major.
Matrix3x3< T > Transpose() const
returns transposed matrix tested 12.06.2002
Definition: Matrix3x3.cpp:167
Matrix3x3< T > & operator=(const Matrix3x3< T > &mat)
assignment operator
Definition: Matrix3x3.cpp:704
T GetDeterminant() const
returns the Determinant |A| of this
Definition: Matrix3x3.cpp:347
void GetMaxMin(T &max, T &min) const
return biggest and smallest entry
Definition: Matrix3x3.cpp:642
int InvertIP()
In place matrix conversion.
Definition: Matrix3x3.cpp:420
Subscript num_rows() const
Definition: cmat.h:319
is a &#39;fixed size&#39; rectangular matrix of dim.
Definition: Matrix3x3.hh:39
void SetFromColumnVectors(const BIAS::Vector3< T > &v0, const BIAS::Vector3< T > &v1, const BIAS::Vector3< T > &v2)
set this matrix from 3 vectors each representating a column
Definition: Matrix3x3.cpp:208
void SetAsCrossProductMatrix(const Vector3< T > &vec)
Sets matrix from vector as cross product matrix of this vector.
Definition: Matrix3x3.cpp:275
Matrix3x3()
default constructor
Definition: Matrix3x3.hh:61
Matrix3x3< T > & operator+=(const Matrix3x3< T > &arg)
Definition: Matrix3x3.cpp:124
Subscript size() const
Definition: vec.h:262
T Normalize()
divide this by biggest absolute entry, returns biggest entry
Definition: Matrix3x3.cpp:580
BIASCommon_EXPORT std::istream & operator>>(std::istream &is, BIAS::TimeStamp &ts)
Standard input operator for TimeStamps.
Definition: TimeStamp.cpp:157