GiNaCRA  0.6.4
GiNaCRA::RealAlgebraicNumber Class Reference

This class encapsulates several representations of real algebraic numbers and provides crucial operations such as arithmetic, ordering or sign determination on them. More...

#include <RealAlgebraicNumber.h>

Inheritance diagram for GiNaCRA::RealAlgebraicNumber:
Collaboration diagram for GiNaCRA::RealAlgebraicNumber:

Public Member Functions

 RealAlgebraicNumber (bool isRoot, bool isNumeric=false, const numeric &value=0)
 Constructs a real algebraic number with a specified marking as to whether this number stems from a real root computation or not.
 ~RealAlgebraicNumber ()
 Destructor.
virtual std::tr1::shared_ptr
< RealAlgebraicNumber
clone () const
 Clone-"Constructor".
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.
virtual const RealAlgebraicNumberoperator= (const RealAlgebraicNumber &o)
 This real algebraic number gets all values of the other.
virtual GiNaC::sign sgn () const
 Returns sign (GiNaC::ZERO_SIGN, GiNaC::POSITIVE_SIGN, GiNaC::NEGATIVE_SIGN) of this real algebraic number.
virtual 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.
virtual const numeric approximateValue () const
 Computes a numeric value for this real algebraic number approximating it.

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

This class encapsulates several representations of real algebraic numbers and provides crucial operations such as arithmetic, ordering or sign determination on them.

Author:
Joachim Redies
Ulrich Loup
Since:
2011-10-03
Version:
2012-05-02

Definition at line 42 of file RealAlgebraicNumber.h.


Constructor & Destructor Documentation

GiNaCRA::RealAlgebraicNumber::RealAlgebraicNumber ( bool  isRoot,
bool  isNumeric = false,
const numeric &  value = 0 
)

Constructs a real algebraic number with a specified marking as to whether this number stems from a real root computation or not.

Parameters:
isRoottrue marks this real algebraic number to stem from a root computation
isNumerictrue marks this real algebraic number to be representable as an exact numeric (standard is false)
valuethe exact numeric value of this number if available, otherwise mIsNumeric is false and mValue 0

Definition at line 41 of file RealAlgebraicNumber.cpp.

Referenced by clone().


Member Function Documentation

const numeric GiNaCRA::RealAlgebraicNumber::approximateValue ( ) const [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 in GiNaCRA::RealAlgebraicNumberIR, and GiNaCRA::RealAlgebraicNumberNR.

Definition at line 63 of file RealAlgebraicNumber.cpp.

virtual std::tr1::shared_ptr<RealAlgebraicNumber> GiNaCRA::RealAlgebraicNumber::clone ( ) const [inline, virtual]

Clone-"Constructor".

Reimplemented in GiNaCRA::RealAlgebraicNumberIR, and GiNaCRA::RealAlgebraicNumberNR.

Definition at line 66 of file RealAlgebraicNumber.h.

References RealAlgebraicNumber().

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

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 mIsNumeric.

Referenced by GiNaCRA::binaryOperator().

const bool GiNaCRA::RealAlgebraicNumber::isRoot ( ) const [inline]
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 mIsRoot.

Referenced by setIsRoot().

virtual const RealAlgebraicNumber& GiNaCRA::RealAlgebraicNumber::operator= ( const RealAlgebraicNumber o) [inline, virtual]

This real algebraic number gets all values of the other.

Parameters:
oother real algebraic number

Definition at line 120 of file RealAlgebraicNumber.h.

References mIsRoot.

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

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 isRoot(), and 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 in GiNaCRA::RealAlgebraicNumberIR, and GiNaCRA::RealAlgebraicNumberNR.

Definition at line 53 of file RealAlgebraicNumber.cpp.

References 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 in GiNaCRA::RealAlgebraicNumberIR, and GiNaCRA::RealAlgebraicNumberNR.

Definition at line 58 of file RealAlgebraicNumber.cpp.

References GiNaC::ZERO_SIGN.

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

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 mValue.

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


Field Documentation

flag indicating whether this number represents a root of a polynomial or an intermediate point

Definition at line 156 of file RealAlgebraicNumber.h.

Referenced by GiNaCRA::RealAlgebraicNumberNR::do_print(), GiNaCRA::RealAlgebraicNumberIR::do_print(), isRoot(), operator=(), GiNaCRA::RealAlgebraicNumberIR::operator=(), and setIsRoot().


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