DGtal
1.4.2
|
#include <DGtal/arithmetic/LighterSternBrocot.h>
Public Member Functions | |
Node (Integer p1, Integer q1, Quotient u1, Quotient k1, Node *anOrigin) | |
Node * | child (Quotient v) |
Node * | origin () const |
Node * | ancestor () const |
Node * | father () const |
bool | even () const |
bool | odd () const |
bool | isSameDepthLeft () const |
Data Fields | |
Integer | p |
the numerator; More... | |
Integer | q |
the denominator; More... | |
Quotient | u |
the quotient (last coefficient of its continued fraction). More... | |
Quotient | k |
the depth (1+number of coefficients of its continued fraction). More... | |
Node * | myOrigin |
A pointer to the origin node [u_0,...,u_{n-1},1]. More... | |
MapQuotientToNode | myChildren |
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 ascendant and descendants in the Stern-Brocot tree. Nodes are constructed on demand, when the user ask for a descendant or for a specific fraction.
The LighterSternBrocot instances only fractions greater than or equal to 1/1. The node 0/1 does not exist. It is the inverse of 1/0. Given a fraction [u_0,...,u_n], for u_n >= 2, its origin is [u_0,...,u_{n-1},1]. The k-th son, k >= 2, of [u_0,...,u_n] is the fraction [u_0,...,u_n - 1, k].
Definition at line 139 of file LighterSternBrocot.h.
DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::Node | ( | Integer | p1, |
Integer | q1, | ||
Quotient | u1, | ||
Quotient | k1, | ||
Node * | anOrigin | ||
) |
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). |
anOrigin | A pointer to the origin node [u_0,...,u_{n-1},1]. |
Node* DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::ancestor | ( | ) | const |
Node* DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::child | ( | Quotient | v | ) |
|
inline |
Definition at line 193 of file LighterSternBrocot.h.
References DGtal::NumberTraitsImpl< std::decay< T >::type >::even(), and DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::k.
Node* DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::father | ( | ) | const |
|
inline |
Definition at line 201 of file LighterSternBrocot.h.
References DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::odd().
|
inline |
Definition at line 197 of file LighterSternBrocot.h.
References DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::k, and DGtal::NumberTraitsImpl< std::decay< T >::type >::odd().
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::isSameDepthLeft().
Node* DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::origin | ( | ) | const |
Quotient DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::k |
the depth (1+number of coefficients of its continued fraction).
Definition at line 183 of file LighterSternBrocot.h.
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::even(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::odd(), and DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::trueK().
MapQuotientToNode DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::myChildren |
a map which gives the descendant [u_0,...,u_n - 1, 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 189 of file LighterSternBrocot.h.
Node* DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::myOrigin |
A pointer to the origin node [u_0,...,u_{n-1},1].
Definition at line 185 of file LighterSternBrocot.h.
Integer DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::p |
the numerator;
Definition at line 177 of file LighterSternBrocot.h.
Integer DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::q |
the denominator;
Definition at line 179 of file LighterSternBrocot.h.
Quotient DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::u |
the quotient (last coefficient of its continued fraction).
Definition at line 181 of file LighterSternBrocot.h.