DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Data Fields
DGtal::SternBrocot< TInteger, TQuotient >::Node Struct Reference

#include <SternBrocot.h>

Collaboration diagram for DGtal::SternBrocot< TInteger, TQuotient >::Node:
Collaboration graph
[legend]

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
Integer q
Quotient u
Quotient k
NodeascendantLeft
NodeascendantRight
NodedescendantLeft
NodedescendantRight
Nodeinverse

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 103 of file SternBrocot.h.


Constructor & Destructor Documentation

template<typename TInteger , typename TQuotient >
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 
)
inline

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.

Definition at line 50 of file SternBrocot.ih.

: p( p1 ), q( q1 ), u( u1 ), k( k1 ),
ascendantLeft( ascendant_left1 ),
ascendantRight( ascendant_right1 ),
descendantLeft( descendant_left1 ),
descendantRight( descendant_right1 ),
inverse( inverse1 )
{
// std::cerr << "(" << p1 << "/" << q1 << "," << u1 << "," << k1 << ")";
}

Field Documentation

template<typename TInteger, typename TQuotient = int32_t>
Node* DGtal::SternBrocot< TInteger, TQuotient >::Node::ascendantLeft
template<typename TInteger, typename TQuotient = int32_t>
Node* DGtal::SternBrocot< TInteger, TQuotient >::Node::ascendantRight
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 136 of file SternBrocot.h.

Referenced by DGtal::SternBrocot< TInteger, TQuotient >::Fraction::left(), and DGtal::SternBrocot< TInteger, TQuotient >::SternBrocot().

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 138 of file SternBrocot.h.

Referenced by DGtal::SternBrocot< TInteger, TQuotient >::Fraction::left(), and DGtal::SternBrocot< TInteger, TQuotient >::SternBrocot().

template<typename TInteger, typename TQuotient = int32_t>
Node* DGtal::SternBrocot< TInteger, TQuotient >::Node::inverse
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 130 of file SternBrocot.h.

Referenced by DGtal::SternBrocot< TInteger, TQuotient >::Fraction::getCFrac(), and DGtal::SternBrocot< TInteger, TQuotient >::Fraction::reduced().

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

the numerator;

Definition at line 124 of file SternBrocot.h.

Referenced by DGtal::SternBrocot< TInteger, TQuotient >::Fraction::left().

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

the denominator;

Definition at line 126 of file SternBrocot.h.

Referenced by DGtal::SternBrocot< TInteger, TQuotient >::Fraction::left().

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 128 of file SternBrocot.h.

Referenced by DGtal::SternBrocot< TInteger, TQuotient >::Fraction::father(), and DGtal::SternBrocot< TInteger, TQuotient >::Fraction::getCFrac().


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