DGtal  1.5.beta
SimpleMatrixSpecializations.h
1 
17 #pragma once
18 
31 #if defined(SimpleMatrixSpecializations_RECURSES)
32 #error Recursive header files inclusion detected in SimpleMatrixSpecializations.h
33 #else // defined(SimpleMatrixSpecializations_RECURSES)
35 #define SimpleMatrixSpecializations_RECURSES
36 
37 #if !defined SimpleMatrixSpecializations_h
39 #define SimpleMatrixSpecializations_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/math/linalg/SimpleMatrix.h"
46 #include "DGtal/kernel/NumberTraits.h"
48 
49 namespace DGtal
50 {
51 
52 
54  // template class SimpleMatrixSpecializations
67  template <typename TMatrix, DGtal::Dimension TM, DGtal::Dimension TN>
69  {
70  // ----------------------- Standard services ------------------------------
71 
73  typedef typename TMatrix::Component Component;
75  typedef TMatrix Matrix;
76 
77  BOOST_STATIC_ASSERT( TM == TMatrix::M );
78  BOOST_STATIC_ASSERT( TN == TMatrix::N );
79 
90  const DGtal::Dimension i,
91  const DGtal::Dimension j);
92 
100  static Component determinant(const Matrix &M);
101 
102 
103  }; // end of class SimpleMatrixSpecializations
104 
106  // template class SimpleMatrixSpecializations
111  template <typename TMatrix>
112  struct SimpleMatrixSpecializations<TMatrix,2,2>
113  {
114  // ----------------------- Standard services ------------------------------
115  public:
116 
117  typedef typename TMatrix::Component Component;
118  typedef TMatrix Matrix;
119 
120  BOOST_STATIC_ASSERT( 2 == TMatrix::M );
121  BOOST_STATIC_ASSERT( 2 == TMatrix::N );
122 
133  const DGtal::Dimension i,
134  const DGtal::Dimension j);
135 
143  static Component determinant(const Matrix &aM);
144 
145 
146  }; // end of class SimpleMatrixSpecializations
148  // template class SimpleMatrixSpecializations
153  template <typename TMatrix>
154  struct SimpleMatrixSpecializations<TMatrix,1,1>
155  {
156  // ----------------------- Standard services ------------------------------
157  public:
158 
159  typedef typename TMatrix::Component Component;
160  typedef TMatrix Matrix;
161 
162  BOOST_STATIC_ASSERT( 1 == TMatrix::M );
163  BOOST_STATIC_ASSERT( 1 == TMatrix::N );
164 
175  const DGtal::Dimension i,
176  const DGtal::Dimension j);
177 
185  static Component determinant(const Matrix &aM);
186 
187 
188  }; // end of class SimpleMatrixSpecializations
189 
191  // template class SimpleMatrixSpecializations
196  template <typename TMatrix>
197  struct SimpleMatrixSpecializations<TMatrix,3,3>
198  {
199  // ----------------------- Standard services ------------------------------
200  public:
201 
202  typedef typename TMatrix::Component Component;
203  typedef TMatrix Matrix;
204 
205  BOOST_STATIC_ASSERT( 3 == TMatrix::M );
206  BOOST_STATIC_ASSERT( 3 == TMatrix::N );
207 
218  const DGtal::Dimension i,
219  const DGtal::Dimension j);
220 
228  static Component determinant(const Matrix &M);
229 
230 
231  }; // end of class SimpleMatrixSpecializations
232 
233 } // namespace DGtal
234 
235 
237 // Includes inline functions.
238 #include "DGtal/math/linalg/SimpleMatrixSpecializations.ih"
239 
240 // //
242 
243 #endif // !defined SimpleMatrixSpecializations_h
244 
245 #undef SimpleMatrixSpecializations_RECURSES
246 #endif // else defined(SimpleMatrixSpecializations_RECURSES)
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition: Common.h:136
static Component minorDeterminant(const Matrix &aM, const DGtal::Dimension i, const DGtal::Dimension j)
static Component determinant(const Matrix &aM)
static Component determinant(const Matrix &aM)
static Component minorDeterminant(const Matrix &aM, const DGtal::Dimension i, const DGtal::Dimension j)
static Component determinant(const Matrix &M)
static Component minorDeterminant(const Matrix &M, const DGtal::Dimension i, const DGtal::Dimension j)
Aim: Implement internal matrix services for specialized matrix size.
static Component determinant(const Matrix &M)
static Component minorDeterminant(const Matrix &M, const DGtal::Dimension i, const DGtal::Dimension j)
TMatrix::Component Component
Matrix componenets type.