|
DGtal 2.0.0
|
#include <DGtal/arithmetic/LightSternBrocot.h>
Public Member Functions | |
| Node (Integer p1, Integer q1, Quotient u1, Quotient k1, Node *ascendant) | |
| bool | even () const |
| bool | odd () const |
| bool | isSameDepthLeft () const |
Data Fields | |
| Integer | p |
| the numerator; | |
| Integer | q |
| the denominator; | |
| Quotient | u |
| the quotient (last coefficient of its continued fraction). | |
| Quotient | k |
| the depth (1+number of coefficients of its continued fraction). | |
| Node * | ascendant |
| A pointer to the node that is the preceding principal convergent. | |
| MapQuotientToNode | descendant |
| MapQuotientToNode | descendant2 |
Represents a node in the Stern-Brocot. The node stores information on the irreducible fraction itself (p/q, the partial quotient u, the depth k), but also pointers to ascendants, descendants and inverse in the Stern-Brocot tree. Nodes are constructed on demand, when the user ask for descendant or for a specific fraction.
Essentially a backport from ImaGene.
Definition at line 134 of file LightSternBrocot.h.
| DGtal::LightSternBrocot< TInteger, TQuotient, TMap >::Node::Node | ( | Integer | p1, |
| Integer | q1, | ||
| Quotient | u1, | ||
| Quotient | k1, | ||
| Node * | ascendant ) |
Constructor for node.
| p1 | the numerator. |
| q1 | the denominator. |
| u1 | the quotient (last coefficient of its continued fraction). |
| k1 | the depth (1+number of coefficients of its continued fraction). |
| ascendant | A pointer to the node that is the preceding principal convergent. |
References ascendant, and Node().
Referenced by Node().
|
inline |
Definition at line 169 of file LightSternBrocot.h.
References DGtal::NumberTraitsImpl< std::decay< T >::type >::even(), and k.
|
inline |
Definition at line 177 of file LightSternBrocot.h.
References odd().
|
inline |
Definition at line 173 of file LightSternBrocot.h.
References k, and DGtal::NumberTraitsImpl< std::decay< T >::type >::odd().
Referenced by isSameDepthLeft().
| Node* DGtal::LightSternBrocot< TInteger, TQuotient, TMap >::Node::ascendant |
A pointer to the node that is the preceding principal convergent.
Definition at line 158 of file LightSternBrocot.h.
Referenced by Node().
| MapQuotientToNode DGtal::LightSternBrocot< TInteger, TQuotient, TMap >::Node::descendant |
a map which gives the descendant [..u_n, k] if k is the key. Note that they are left or right descendant according to the parity of the depth. (odd=left, even=right).
Definition at line 162 of file LightSternBrocot.h.
| MapQuotientToNode DGtal::LightSternBrocot< TInteger, TQuotient, TMap >::Node::descendant2 |
a map which gives the descendant [...u_n-1,1, k] if k is the key. Note that they are left or right descendant according to the parity of the depth. (even=left, odd=right).
Definition at line 166 of file LightSternBrocot.h.
| Quotient DGtal::LightSternBrocot< TInteger, TQuotient, TMap >::Node::k |
the depth (1+number of coefficients of its continued fraction).
Definition at line 156 of file LightSternBrocot.h.
| Integer DGtal::LightSternBrocot< TInteger, TQuotient, TMap >::Node::p |
the numerator;
Definition at line 150 of file LightSternBrocot.h.
| Integer DGtal::LightSternBrocot< TInteger, TQuotient, TMap >::Node::q |
the denominator;
Definition at line 152 of file LightSternBrocot.h.
| Quotient DGtal::LightSternBrocot< TInteger, TQuotient, TMap >::Node::u |
the quotient (last coefficient of its continued fraction).
Definition at line 154 of file LightSternBrocot.h.