GiNaCRA  0.6.4
GiNaCRA::RealAlgebraicNumberNR Class Reference

A real algebraic number exactly represented as a numeric. More...

#include <RealAlgebraicNumberNR.h>

Inheritance diagram for GiNaCRA::RealAlgebraicNumberNR:
Collaboration diagram for GiNaCRA::RealAlgebraicNumberNR:

Public Member Functions

 RealAlgebraicNumberNR (const numeric &n, bool isRoot=true)
 Construct a real algebraic number from a numeric n.
 RealAlgebraicNumberNR (const RealAlgebraicNumberNR &n)
 Copy constructor.
RealAlgebraicNumberPtr clone () const
 Clone-"Constructor".
GiNaC::sign sgn () const
 Returns sign (GiNaC::ZERO_SIGN, GiNaC::POSITIVE_SIGN, GiNaC::NEGATIVE_SIGN) of this real algebraic number.
GiNaC::sign sgn (const RationalUnivariatePolynomial &p) const
 Returns sign (GiNaC::ZERO_SIGN, GiNaC::POSITIVE_SIGN, GiNaC::NEGATIVE_SIGN) of the specified univariate polynomial at this real algebraic number.
const numeric approximateValue () const
 Computes a numeric value for this real algebraic number approximating it.
const bool isRoot () const
void setIsRoot (bool isRoot)
 Set the flag marking whether the real algebraic number stems from a root computation or not.
bool isNumeric () const
 Returns true if an exact numeric representation was found during the refinements.
const numeric value () const
 Gives an exact numeric representation of this real algebraic number which could have been found during the refinement steps.

Protected Member Functions

void do_print (const print_context &c, unsigned level=0) const

Protected Attributes

bool mIsRoot
 flag indicating whether this number represents a root of a polynomial or an intermediate point
bool mIsNumeric
 flag indicating whether this number is representable by a numeric
numeric mValue
 the exact numeric value of this number if available, otherwise mIsNumeric is false and mValue 0

Detailed Description

A real algebraic number exactly represented as a numeric.

Author:
Joachim Redies
Ulrich Loup
Since:
2011-10-14
Version:
2012-03-15

Definition at line 41 of file RealAlgebraicNumberNR.h.


Constructor & Destructor Documentation

GiNaCRA::RealAlgebraicNumberNR::RealAlgebraicNumberNR ( const numeric &  n,
bool  isRoot = true 
)

Construct a real algebraic number from a numeric n.

Parameters:
n
isRoottrue marks this real algebraic number to stem from a root computation

Definition at line 46 of file RealAlgebraicNumberNR.cpp.

References GiNaCRA::RealAlgebraicNumber::mValue.

Referenced by clone().

Copy constructor.

Parameters:
n

Definition at line 53 of file RealAlgebraicNumberNR.cpp.

References GiNaCRA::RealAlgebraicNumber::mValue.


Member Function Documentation

const numeric GiNaCRA::RealAlgebraicNumberNR::approximateValue ( ) const [inline, virtual]

Computes a numeric value for this real algebraic number approximating it.

Runtime complexity:
constant
Returns:
a numeric value for this real algebraic number approximating it

Reimplemented from GiNaCRA::RealAlgebraicNumber.

Definition at line 93 of file RealAlgebraicNumberNR.h.

Clone-"Constructor".

Reimplemented from GiNaCRA::RealAlgebraicNumber.

Definition at line 67 of file RealAlgebraicNumberNR.h.

References RealAlgebraicNumberNR().

void GiNaCRA::RealAlgebraicNumberNR::do_print ( const print_context &  c,
unsigned  level = 0 
) const [protected]

Definition at line 92 of file RealAlgebraicNumberNR.cpp.

References GiNaCRA::RealAlgebraicNumber::mIsRoot.

bool GiNaCRA::RealAlgebraicNumber::isNumeric ( ) const [inline, inherited]

Returns true if an exact numeric representation was found during the refinements.

Returns:
true if an exact numeric representation was found during the refinements, false otherwise.

Definition at line 96 of file RealAlgebraicNumber.h.

References GiNaCRA::RealAlgebraicNumber::mIsNumeric.

Referenced by GiNaCRA::binaryOperator().

const bool GiNaCRA::RealAlgebraicNumber::isRoot ( ) const [inline, inherited]
Returns:
the flag marking whether the real algebraic number stems from a root computation or not

Definition at line 78 of file RealAlgebraicNumber.h.

References GiNaCRA::RealAlgebraicNumber::mIsRoot.

Referenced by GiNaCRA::RealAlgebraicNumber::setIsRoot().

void GiNaCRA::RealAlgebraicNumber::setIsRoot ( bool  isRoot) [inline, inherited]

Set the flag marking whether the real algebraic number stems from a root computation or not.

Parameters:
isRoot

Definition at line 87 of file RealAlgebraicNumber.h.

References GiNaCRA::RealAlgebraicNumber::isRoot(), and GiNaCRA::RealAlgebraicNumber::mIsRoot.

Returns sign (GiNaC::ZERO_SIGN, GiNaC::POSITIVE_SIGN, GiNaC::NEGATIVE_SIGN) of this real algebraic number.

Returns:
sign of this real algebraic number.

Reimplemented from GiNaCRA::RealAlgebraicNumber.

Definition at line 64 of file RealAlgebraicNumberNR.cpp.

References GiNaC::NEGATIVE_SIGN, GiNaC::POSITIVE_SIGN, and GiNaC::ZERO_SIGN.

Returns sign (GiNaC::ZERO_SIGN, GiNaC::POSITIVE_SIGN, GiNaC::NEGATIVE_SIGN) of the specified univariate polynomial at this real algebraic number.

Parameters:
prational univariate polynomial
Returns:
sign of the univariate polynomial at this real algebraic number.

Reimplemented from GiNaCRA::RealAlgebraicNumber.

Definition at line 74 of file RealAlgebraicNumberNR.cpp.

References GiNaC::NEGATIVE_SIGN, GiNaC::POSITIVE_SIGN, GiNaCRA::RationalUnivariatePolynomial::sgn(), and GiNaC::ZERO_SIGN.

const numeric GiNaCRA::RealAlgebraicNumber::value ( ) const [inline, inherited]

Gives an exact numeric representation of this real algebraic number which could have been found during the refinement steps.

The method returns 0 if the value was never set during refinement.

Returns:
an exact numeric representation of this real algebraic number which could have been found during the refinement steps

Definition at line 105 of file RealAlgebraicNumber.h.

References GiNaCRA::RealAlgebraicNumber::mValue.

Referenced by GiNaCRA::binaryOperator(), and GiNaCRA::RealAlgebraicNumberFactory::less().


Field Documentation

bool GiNaCRA::RealAlgebraicNumber::mIsRoot [protected, inherited]

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