DGtal 1.4.0
|
Aim: Small class useful to compute the determinant of a 2x2 matrix from its four coefficients, ie. \( \begin{vmatrix} a & x \\ b & y \end{vmatrix} \). More...
#include <DGtal/geometry/tools/determinant/Simple2x2DetComputer.h>
Public Types | |
typedef TArgumentInteger | ArgumentInteger |
typedef ArgumentInteger | Integer |
typedef ArgumentInteger | argument_type |
typedef TResultInteger | ResultInteger |
typedef ResultInteger | Value |
typedef ResultInteger | result_type |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CEuclideanRing< ArgumentInteger >)) | |
BOOST_CONCEPT_ASSERT ((concepts::CEuclideanRing< ArgumentInteger >)) | |
Simple2x2DetComputer () | |
Simple2x2DetComputer (const Simple2x2DetComputer &other) | |
Simple2x2DetComputer & | operator= (const Simple2x2DetComputer &other) |
~Simple2x2DetComputer () | |
void | init (const ArgumentInteger &aA, const ArgumentInteger &aB) |
ResultInteger | operator() (const ArgumentInteger &aX, const ArgumentInteger &aY) const |
ResultInteger | operator() (const ArgumentInteger &aA, const ArgumentInteger &aB, const ArgumentInteger &aX, const ArgumentInteger &aY) |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Private Attributes | |
ResultInteger | myA |
ResultInteger | myB |
ResultInteger | myAY |
ResultInteger | myBX |
Aim: Small class useful to compute the determinant of a 2x2 matrix from its four coefficients, ie. \( \begin{vmatrix} a & x \\ b & y \end{vmatrix} \).
This class, which is a model of C2x2DetComputer, just computes the quantity \( ay - bx \).
In order to use Simple2x2DetComputer in its incremental form:
Note that since a substantial part of the execution time comes from the allocation/desallocation of integers, we follow the same strategy used in IntegerComputer: the user instantiates once this object and computes the determinant several times with it.
TArgumentInteger | a model of CEuclideanRing for the input coefficients of the 2x2 matrix |
TResultInteger | a model of CEuclideanRing for the result. It must be either unbounded or twice as big as TArgumentInteger, ie. if TArgumentInteger is a type coded on b bits, TResultInteger must be coded on 2b+1 bits |
Note that if you use the same type for the arguments and the result, the code may fail to provide the exact result because of a possible overflow.
Definition at line 92 of file Simple2x2DetComputer.h.
typedef ArgumentInteger DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::argument_type |
STL alias of type ArgumentInteger
Definition at line 108 of file Simple2x2DetComputer.h.
typedef TArgumentInteger DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::ArgumentInteger |
Type of integer for the input coefficients of the 2x2 matrix
Definition at line 99 of file Simple2x2DetComputer.h.
typedef ArgumentInteger DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::Integer |
DGtal alias of type ArgumentInteger
Definition at line 104 of file Simple2x2DetComputer.h.
typedef ResultInteger DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::result_type |
STL alias of type ResultInteger
Definition at line 123 of file Simple2x2DetComputer.h.
typedef TResultInteger DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::ResultInteger |
Type of integer for the returned determinant
Definition at line 113 of file Simple2x2DetComputer.h.
typedef ResultInteger DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::Value |
DGtal alias type of ResultInteger
Definition at line 119 of file Simple2x2DetComputer.h.
DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::Simple2x2DetComputer | ( | ) |
Default constructor.
DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::Simple2x2DetComputer | ( | const Simple2x2DetComputer< TArgumentInteger, TResultInteger > & | other | ) |
Copy constructor.
other | the object to clone. |
DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::~Simple2x2DetComputer | ( | ) |
Destructor.
DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::BOOST_CONCEPT_ASSERT | ( | (concepts::CEuclideanRing< ArgumentInteger >) | ) |
DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::BOOST_CONCEPT_ASSERT | ( | (concepts::CEuclideanRing< ArgumentInteger >) | ) |
void DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::init | ( | const ArgumentInteger & | aA, |
const ArgumentInteger & | aB ) |
Initialisation.
aA | 0-component of the first column vector |
aB | 1-component of the first column vector |
bool DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::isValid | ( | ) | const |
Checks the validity/consistency of the object.
ResultInteger DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::operator() | ( | const ArgumentInteger & | aA, |
const ArgumentInteger & | aB, | ||
const ArgumentInteger & | aX, | ||
const ArgumentInteger & | aY ) |
Operator.
aA | 0-component of the first column vector |
aB | 1-component of the first column vector |
aX | 0-component of the second column vector |
aY | 1-component of the second column vector |
ResultInteger DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::operator() | ( | const ArgumentInteger & | aX, |
const ArgumentInteger & | aY ) const |
Incremental operator.
aX | 0-component of the second column vector |
aY | 1-component of the second column vector |
Simple2x2DetComputer & DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::operator= | ( | const Simple2x2DetComputer< TArgumentInteger, TResultInteger > & | other | ) |
Assignment.
other | the object to copy. |
void DGtal::Simple2x2DetComputer< TArgumentInteger, TResultInteger >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
private |
Data member used to store the 0-component of the first column vector, ie. a.
Definition at line 202 of file Simple2x2DetComputer.h.
|
mutableprivate |
Data member used to store the product ay
Definition at line 211 of file Simple2x2DetComputer.h.
|
private |
Data member used to store the 1-component of the first column vector, ie. b.
Definition at line 207 of file Simple2x2DetComputer.h.
|
mutableprivate |
Data member used to store the product bx
Definition at line 215 of file Simple2x2DetComputer.h.