DGtal 2.2.0
Loading...
Searching...
No Matches
DGtal::SternBrocot< TInteger, TQuotient >::Node Struct Reference

#include <DGtal/arithmetic/SternBrocot.h>

Public Member Functions

 Node (Integer p1, Integer q1, Quotient u1, Quotient k1, Node *ascendant_left1, Node *ascendant_right1, Node *descendant_left1, Node *descendant_right1, Node *inverse1)

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 * ascendantLeft
 the node that is the left ascendant.
Node * ascendantRight
 the node that is the right ascendant.
Node * descendantLeft
 the node that is the left descendant or 0 (if none exist).
Node * descendantRight
 the node that is the right descendant or 0 (if none exist).
Node * inverse
 the node that is its inverse.

Detailed Description

template<typename TInteger, typename TQuotient = int32_t>
struct DGtal::SternBrocot< TInteger, TQuotient >::Node

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.

See also
SternBrocot::fraction

Essentially a backport from ImaGene.

Definition at line 100 of file SternBrocot.h.

Constructor & Destructor Documentation

◆ Node()

template<typename TInteger, typename TQuotient = int32_t>
DGtal::SternBrocot< TInteger, TQuotient >::Node::Node ( Integer p1,
Integer q1,
Quotient u1,
Quotient k1,
Node * ascendant_left1,
Node * ascendant_right1,
Node * descendant_left1,
Node * descendant_right1,
Node * inverse1 )

Constructor for node.

Parameters
p1the numerator.
q1the denominator.
u1the quotient (last coefficient of its continued fraction).
k1the depth (1+number of coefficients of its continued fraction).
ascendant_left1the node that is the left ascendant.
ascendant_right1the node that is the right ascendant.
descendant_left1the node that is the left descendant or 0 (if none exist).
descendant_right1the node that is the right descendant or 0 (if none exist).
inverse1the node that is its inverse.

References Node().

Referenced by Node().

Field Documentation

◆ ascendantLeft

template<typename TInteger, typename TQuotient = int32_t>
Node* DGtal::SternBrocot< TInteger, TQuotient >::Node::ascendantLeft

the node that is the left ascendant.

Definition at line 129 of file SternBrocot.h.

◆ ascendantRight

template<typename TInteger, typename TQuotient = int32_t>
Node* DGtal::SternBrocot< TInteger, TQuotient >::Node::ascendantRight

the node that is the right ascendant.

Definition at line 131 of file SternBrocot.h.

◆ descendantLeft

template<typename TInteger, typename TQuotient = int32_t>
Node* DGtal::SternBrocot< TInteger, TQuotient >::Node::descendantLeft

the node that is the left descendant or 0 (if none exist).

Definition at line 133 of file SternBrocot.h.

◆ descendantRight

template<typename TInteger, typename TQuotient = int32_t>
Node* DGtal::SternBrocot< TInteger, TQuotient >::Node::descendantRight

the node that is the right descendant or 0 (if none exist).

Definition at line 135 of file SternBrocot.h.

◆ inverse

template<typename TInteger, typename TQuotient = int32_t>
Node* DGtal::SternBrocot< TInteger, TQuotient >::Node::inverse

the node that is its inverse.

Definition at line 137 of file SternBrocot.h.

◆ k

template<typename TInteger, typename TQuotient = int32_t>
Quotient DGtal::SternBrocot< TInteger, TQuotient >::Node::k

the depth (1+number of coefficients of its continued fraction).

Definition at line 127 of file SternBrocot.h.

◆ p

template<typename TInteger, typename TQuotient = int32_t>
Integer DGtal::SternBrocot< TInteger, TQuotient >::Node::p

the numerator;

Definition at line 121 of file SternBrocot.h.

◆ q

template<typename TInteger, typename TQuotient = int32_t>
Integer DGtal::SternBrocot< TInteger, TQuotient >::Node::q

the denominator;

Definition at line 123 of file SternBrocot.h.

◆ u

template<typename TInteger, typename TQuotient = int32_t>
Quotient DGtal::SternBrocot< TInteger, TQuotient >::Node::u

the quotient (last coefficient of its continued fraction).

Definition at line 125 of file SternBrocot.h.


The documentation for this struct was generated from the following file: