DGtal  0.9.2
SimpleIncremental2x2DetComputer.h
1 
17 #pragma once
18 
31 #if defined(SimpleIncremental2x2DetComputer_RECURSES)
32 #error Recursive header files inclusion detected in SimpleIncremental2x2DetComputer.h
33 #else // defined(SimpleIncremental2x2DetComputer_RECURSES)
34 
35 #define SimpleIncremental2x2DetComputer_RECURSES
36 
37 #if !defined SimpleIncremental2x2DetComputer_h
38 
39 #define SimpleIncremental2x2DetComputer_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 
46 #include "DGtal/kernel/NumberTraits.h"
47 #include "DGtal/kernel/CEuclideanRing.h"
49 
50 namespace DGtal
51 {
52 
54  // template class SimpleIncremental2x2DetComputer
92  template <typename TArgumentInteger, typename TResultInteger = TArgumentInteger>
94  {
95  // ----------------------- Types ----------------------------------------
96  public:
100  typedef TArgumentInteger ArgumentInteger;
105  typedef ArgumentInteger Integer;
109  typedef ArgumentInteger argument_type;
110 
114  typedef TResultInteger ResultInteger;
116 
120  typedef ResultInteger Value;
124  typedef ResultInteger result_type;
125 
126  // ----------------------- Standard services ------------------------------
127  public:
128 
133 
139 
146 
151 
152  // ----------------------- Interface --------------------------------------
153  public:
154 
161  void init(const ArgumentInteger& aA, const ArgumentInteger& aB);
162 
171  ResultInteger operator()(const ArgumentInteger& aX, const ArgumentInteger& aY) const;
172 
182  ResultInteger operator()(const ArgumentInteger& aA, const ArgumentInteger& aB,
183  const ArgumentInteger& aX, const ArgumentInteger& aY);
184 
185 
190  void selfDisplay ( std::ostream & out ) const;
191 
196  bool isValid() const;
197 
198  // ------------------------- Private Datas --------------------------------
199  private:
204  ResultInteger myA;
209  ResultInteger myB;
213  mutable ResultInteger myAY;
217  mutable ResultInteger myBX;
221  mutable ResultInteger myDet;
226  mutable ResultInteger myX;
231  mutable ResultInteger myY;
236  mutable ResultInteger myDX;
241  mutable ResultInteger myDY;
245  mutable ResultInteger myADY;
249  mutable ResultInteger myBDX;
253  mutable ResultInteger myDDet;
254 
255  const ResultInteger myZero;
256  // ------------------------- Hidden services ------------------------------
257  protected:
258 
259 
260  // ------------------------- Internals ------------------------------------
261  private:
262 
268  void partialComputation() const;
269 
270  }; // end of class SimpleIncremental2x2DetComputer
271 
272 
279  template <typename TI, typename TO>
280  std::ostream&
281  operator<< ( std::ostream & out, const SimpleIncremental2x2DetComputer<TI,TO> & object );
282 
283 } // namespace DGtal
284 
285 
287 // Includes inline functions.
288 #include "DGtal/geometry/tools/determinant/SimpleIncremental2x2DetComputer.ih"
289 
290 // //
292 
293 #endif // !defined SimpleIncremental2x2DetComputer_h
294 
295 #undef SimpleIncremental2x2DetComputer_RECURSES
296 #endif // else defined(SimpleIncremental2x2DetComputer_RECURSES)
void selfDisplay(std::ostream &out) const
Aim: Defines the mathematical concept equivalent to a unitary commutative ring with a division operat...
BOOST_CONCEPT_ASSERT((concepts::CEuclideanRing< ArgumentInteger >))
DGtal is the top-level namespace which contains all DGtal functions and types.
SimpleIncremental2x2DetComputer & operator=(const SimpleIncremental2x2DetComputer &other)
ResultInteger operator()(const ArgumentInteger &aX, const ArgumentInteger &aY) const
void init(const ArgumentInteger &aA, const ArgumentInteger &aB)
Aim: Small class useful to compute, in an incremental way, the determinant of a 2x2 matrix from its f...