atlas  0.6
Public Member Functions | Private Types | List of all members
atlas::polynomials::Safe_Poly< C > Class Template Reference

#include <Atlas.h>

Inheritance diagram for atlas::polynomials::Safe_Poly< C >:
Inheritance graph
[legend]
Collaboration diagram for atlas::polynomials::Safe_Poly< C >:
Collaboration graph
[legend]

Public Member Functions

 Safe_Poly ()
 
 Safe_Poly (Degree d, C c)
 
void safeAdd (const Safe_Poly &p, Degree d, C c)
 Adds x^d.c.q, to *this, watching for overflow, assuming |c>0|. More...
 
void safeAdd (const Safe_Poly &p, Degree d=0)
 
void safeDivide (C c)
 Divides polynomial by scalar c, throwing an error is division is inexact. More...
 
void safeQuotient (Degree d=0)
 
void safeSubtract (const Safe_Poly &p, Degree d, C c)
 Subtracts x^d.c.q from *this, watching for underflow, assuming |c>0|. More...
 
void safeSubtract (const Safe_Poly &p, Degree d=0)
 
- Public Member Functions inherited from atlas::polynomials::Polynomial< C >
 Polynomial ()
 
 Polynomial (C c)
 
 Polynomial (Degree d, C c)
 Constructs cX^d. More...
 
 Polynomial (Degree d, const Polynomial &Q)
 
template<typename U >
 Polynomial (const Polynomial< U > &src)
 
void swap (Polynomial &other)
 
const C & operator[] (Degree i) const
 
const C coef (Degree i) const
 
bool operator== (const Polynomial &q) const
 
bool operator!= (const Polynomial &q) const
 
bool operator< (const Polynomial &q) const
 Operator < is the default from the standard library < on vector. More...
 
std::vector< C >::const_iterator begin () const
 
std::vector< C >::const_iterator end () const
 
Degree degree () const
 
Degree size () const
 
bool isZero () const
 
bool multi_term () const
 
up_remainder (C c, Degree d) const
 
C & operator[] (Degree j)
 
Polynomialoperator+= (const Polynomial &q)
 
Polynomialoperator-= (const Polynomial &q)
 
Polynomialsubtract_from (const Polynomial &p)
 
Polynomialoperator*= (C)
 
Polynomialoperator/= (C)
 
Polynomial operator* (C c) const
 
Polynomial operator* (const Polynomial &q) const
 
Polynomialoperator*= (const Polynomial &q)
 
Polynomial operator+ (const Polynomial &q) const
 
Polynomial operator- (const Polynomial &q) const
 
Polynomial operator- () const
 
factor_by (C c, Degree d)
 
std::ostream & print (std::ostream &strm, const char *x) const
 

Private Types

typedef Polynomial< C > base
 

Additional Inherited Members

- Protected Member Functions inherited from atlas::polynomials::Polynomial< C >
void resize (Degree d)
 
void adjustSize ()
 Adjusts the size of d_data so that it corresponds to the degree + 1. More...
 

Member Typedef Documentation

template<typename C >
typedef Polynomial<C> atlas::polynomials::Safe_Poly< C >::base
private

Constructor & Destructor Documentation

template<typename C >
atlas::polynomials::Safe_Poly< C >::Safe_Poly ( )
inline
template<typename C >
atlas::polynomials::Safe_Poly< C >::Safe_Poly ( Degree  d,
c 
)
inlineexplicit

Member Function Documentation

template<typename C >
void atlas::polynomials::Safe_Poly< C >::safeAdd ( const Safe_Poly< C > &  q,
Degree  d,
c 
)

Adds x^d.c.q, to *this, watching for overflow, assuming |c>0|.

NOTE: may forward a NumericOverflow exception.

NOTE: we need to be careful in the case where q = *this, but we can avoid making a copy, by doing the addition top-to-bottom.

template<typename C >
void atlas::polynomials::Safe_Poly< C >::safeAdd ( const Safe_Poly< C > &  p,
Degree  d = 0 
)
template<typename C >
void atlas::polynomials::Safe_Poly< C >::safeDivide ( c)

Divides polynomial by scalar c, throwing an error is division is inexact.

template<typename C >
void atlas::polynomials::Safe_Poly< C >::safeQuotient ( Degree  d = 0)
template<typename C >
void atlas::polynomials::Safe_Poly< C >::safeSubtract ( const Safe_Poly< C > &  q,
Degree  d,
c 
)

Subtracts x^d.c.q from *this, watching for underflow, assuming |c>0|.

NOTE: may forward a NumericUnderflow exception.

NOTE: q = *this is possible only for d = 0; still, we do the prudent thing and subtract backwards.

template<typename C >
void atlas::polynomials::Safe_Poly< C >::safeSubtract ( const Safe_Poly< C > &  p,
Degree  d = 0 
)

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