DGtal
0.6.devel
|
#include <LighterSternBrocot.h>
Public Member Functions | |
Node (Integer p1, Integer q1, Quotient u1, Quotient k1, Node *_origin) | |
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 |
Integer | q |
Quotient | u |
Quotient | k |
Node * | myOrigin |
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 140 of file LighterSternBrocot.h.
|
inline |
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). |
<em>origin | A pointer to the origin node [u_0,...,u{n-1},1]. |
Definition at line 50 of file LighterSternBrocot.ih.
|
inline |
Definition at line 119 of file LighterSternBrocot.ih.
References DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::child(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::instance(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::myOneOverZero, DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::origin(), and DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::u.
|
inline |
Definition at line 64 of file LighterSternBrocot.ih.
References DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::instance(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::myOneOverOne, DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::myOneOverZero, and DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::nbFractions.
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::ancestor(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::father(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::Fraction(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::left(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::next(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::reduced(), and DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::right().
|
inline |
Definition at line 194 of file LighterSternBrocot.h.
References DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::k.
|
inline |
Definition at line 133 of file LighterSternBrocot.ih.
References DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::child(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::instance(), and DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::myOneOverZero.
|
inline |
Definition at line 202 of file LighterSternBrocot.h.
References DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::odd().
|
inline |
Definition at line 198 of file LighterSternBrocot.h.
References DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::k.
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::isSameDepthLeft().
|
inline |
Definition at line 110 of file LighterSternBrocot.ih.
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::ancestor(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::left(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::next(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::reduced(), and DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::right().
Quotient DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::k |
the depth (1+number of coefficients of its continued fraction).
Definition at line 184 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 190 of file LighterSternBrocot.h.
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::LighterSternBrocot().
Node* DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::myOrigin |
A pointer to the origin node [u_0,...,u_{n-1},1].
Definition at line 186 of file LighterSternBrocot.h.
Integer DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::p |
the numerator;
Definition at line 178 of file LighterSternBrocot.h.
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::operator==().
Integer DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::q |
the denominator;
Definition at line 180 of file LighterSternBrocot.h.
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::operator==().
Quotient DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::u |
the quotient (last coefficient of its continued fraction).
Definition at line 182 of file LighterSternBrocot.h.
Referenced by DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Node::ancestor(), DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::reduced(), and DGtal::LighterSternBrocot< TInteger, TQuotient, TMap >::Fraction::u().