Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SymmetricMatrix3x3.hh
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 
9  BIAS is free software; you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation; either version 2.1 of the License, or
12  (at your option) any later version.
13 
14  BIAS is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with BIAS; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/
22 #ifndef __SymmetricMatrix3x3_hh__
23 #define __SymmetricMatrix3x3_hh__
24 
25 #include "bias_config.h"
26 #include <iostream>
27 
28 namespace BIAS {
29 
30  // forward declarations
31  template <class T> class Matrix3x3;
32  template <class T> class Matrix;
33 
34  // forward declaration for stream operator
35  template <class T> class BIASMathBase_EXPORT SymmetricMatrix3x3;
36 
37  // stream operators
38  template <class T> BIASMathBase_EXPORT
39  std::ostream& operator<<(std::ostream& os, const SymmetricMatrix3x3<T>& mat);
40 
41  template <class T> BIASMathBase_EXPORT
42  std::istream& operator>>(std::istream& is, SymmetricMatrix3x3<T>& mat);
43 
44  /** @class SymmetricMatrix3x3
45  @ingroup g_math
46  @brief is a 'fixed size' symmetric quadratic matrix of dim. 3 x 3 which
47  is templated over the element-type. The class is memory efficient,
48  storing only the necessary 6 independent elements of the symmetric matrix.
49 
50  @author woelk 11/2007 (c) www.vision-n.de */
51  template <class T=double>
52  class BIASMathBase_EXPORT SymmetricMatrix3x3
53  {
54  public:
56 
58 
59  SymmetricMatrix3x3(const Matrix3x3<T>& src);
60 
61  SymmetricMatrix3x3(const Matrix<T>& src);
62 
64 
65  SymmetricMatrix3x3<T>& operator=(const SymmetricMatrix3x3<T>& src);
66 
67  /// element access
68  T& operator()(const unsigned row, const unsigned col);
69  const T& operator()(const unsigned row, const unsigned col) const;
70 
71  /// conversion to full matrix
72  void GetMatrix(Matrix3x3<T>& dst) const;
73  Matrix3x3<T> GetMatrix() const;
74 
75  /// binary io
76  int Write(std::ostream& os) const;
77  int Read(std::istream& is);
78 
79  /// stream operators are declared as friends
80  friend BIASMathBase_EXPORT std::ostream&
81  operator<<<T>(std::ostream& os, const SymmetricMatrix3x3<T>& mat);
82  friend BIASMathBase_EXPORT std::istream&
83  operator>><T>(std::istream& is, SymmetricMatrix3x3<T>& mat);
84 
85  T* GetData() { return Data_; };
86  const T* GetData() const { return Data_; }
87  protected:
88 
89  unsigned SymMatrix3x3ToIndex_(const unsigned row, const unsigned col) const;
90 
91  /// The matrix data is stored as follows
92  /// | Data_[0] Data_[1] Data_[2] |
93  /// | Data_[1] Data_[3] Data_[4] |
94  /// | Data_[2] Data_[4] Data_[5] |
95  T Data_[6];
96 
97  }; // class
98 
99 
100 } // namespace
101 
102 
103 #endif // __SymmetricMatrix3x3_hh__
class BIASMathBase_EXPORT SymmetricMatrix3x3
const T * GetData() const
class BIASMathBase_EXPORT Matrix
Definition: Operators.hh:37
is a 'fixed size' quadratic matrix of dim.
Definition: Matrix.hh:54
class BIASMathBase_EXPORT Matrix3x3
matrix class with arbitrary size, indexing is row major.
BIASCommon_EXPORT std::istream & operator>>(std::istream &is, BIAS::TimeStamp &ts)
Standard input operator for TimeStamps.
Definition: TimeStamp.cpp:157
is a 'fixed size' symmetric quadratic matrix of dim.