Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Geom::SBasis Class Reference

Polynomial in symmetric power basis. More...

#include <sbasis.h>

Public Types

typedef std::vector< Linear >::iterator iterator
 
typedef std::vector< Linear >::const_iterator const_iterator
 
typedef double output_type
 

Public Member Functions

size_t size () const
 
Linear operator[] (unsigned i) const
 
Linearoperator[] (unsigned i)
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
bool empty () const
 
Linearback ()
 
Linear const & back () const
 
void pop_back ()
 
void resize (unsigned n)
 
void resize (unsigned n, Linear const &l)
 
void reserve (unsigned n)
 
void clear ()
 
void insert (iterator before, const_iterator src_begin, const_iterator src_end)
 
Linearat (unsigned i)
 
bool operator== (SBasis const &B) const
 
bool operator!= (SBasis const &B) const
 
 SBasis ()
 
 SBasis (double a)
 
 SBasis (double a, double b)
 
 SBasis (SBasis const &a)
 
 SBasis (std::vector< Linear > ls)
 
 SBasis (Linear const &bo)
 
 SBasis (Linear *bo)
 
 SBasis (size_t n, Linear const &l)
 
 SBasis (Coord c0, Coord c1, Coord c2, Coord c3)
 
 SBasis (Coord c0, Coord c1, Coord c2, Coord c3, Coord c4, Coord c5)
 
 SBasis (Coord c0, Coord c1, Coord c2, Coord c3, Coord c4, Coord c5, Coord c6, Coord c7)
 
 SBasis (Coord c0, Coord c1, Coord c2, Coord c3, Coord c4, Coord c5, Coord c6, Coord c7, Coord c8, Coord c9)
 
template<typename Iter >
 SBasis (Iter first, Iter last)
 
bool isZero (double eps=EPSILON) const
 
bool isConstant (double eps=EPSILON) const
 
bool isFinite () const
 test all coefficients are finite
 
Coord at0 () const
 
Coordat0 ()
 
Coord at1 () const
 
Coordat1 ()
 
int degreesOfFreedom () const
 
double valueAt (double t) const
 
double operator() (double t) const
 
std::vector< double > valueAndDerivatives (double t, unsigned n) const
 Compute the value and the first n derivatives.
 
SBasis toSBasis () const
 
double tailError (unsigned tail) const
 bound the error from term truncation
 
SBasis operator() (SBasis const &g) const
 
void normalize ()
 
void truncate (unsigned k)
 

Private Member Functions

void push_back (Linear const &l)
 
void derive ()
 Compute the derivative of this inplace (Exact)
 

Private Attributes

std::vector< Lineard
 

Related Symbols

(Note that these are not member symbols.)

SBasis reverse (SBasis const &a)
 Returns a function which reverses the domain of a.
 
unsigned valuation (SBasis const &a, double tol=0)
 Returns the degree of the first non zero coefficient.
 
SBasis portion (const SBasis &t, double from, double to)
 Returns the sbasis on domain [0,1] that was t on [from, to].
 

Detailed Description

Polynomial in symmetric power basis.

Definition at line 70 of file sbasis.h.

Member Typedef Documentation

◆ const_iterator

typedef std::vector<Linear>::const_iterator Geom::SBasis::const_iterator

Definition at line 78 of file sbasis.h.

◆ iterator

typedef std::vector<Linear>::iterator Geom::SBasis::iterator

Definition at line 77 of file sbasis.h.

◆ output_type

typedef double Geom::SBasis::output_type

Definition at line 194 of file sbasis.h.

Constructor & Destructor Documentation

◆ SBasis() [1/13]

Geom::SBasis::SBasis ( )
inline

◆ SBasis() [2/13]

Geom::SBasis::SBasis ( double  a)
inlineexplicit

Definition at line 115 of file sbasis.h.

◆ SBasis() [3/13]

Geom::SBasis::SBasis ( double  a,
double  b 
)
inlineexplicit

Definition at line 118 of file sbasis.h.

◆ SBasis() [4/13]

Geom::SBasis::SBasis ( SBasis const &  a)
inline

Definition at line 121 of file sbasis.h.

◆ SBasis() [5/13]

Geom::SBasis::SBasis ( std::vector< Linear ls)
inline

Definition at line 124 of file sbasis.h.

◆ SBasis() [6/13]

Geom::SBasis::SBasis ( Linear const &  bo)
inline

Definition at line 127 of file sbasis.h.

◆ SBasis() [7/13]

Geom::SBasis::SBasis ( Linear bo)
inline

Definition at line 130 of file sbasis.h.

◆ SBasis() [8/13]

Geom::SBasis::SBasis ( size_t  n,
Linear const &  l 
)
inlineexplicit

Definition at line 133 of file sbasis.h.

◆ SBasis() [9/13]

Geom::SBasis::SBasis ( Coord  c0,
Coord  c1,
Coord  c2,
Coord  c3 
)
inline

Definition at line 135 of file sbasis.h.

◆ SBasis() [10/13]

Geom::SBasis::SBasis ( Coord  c0,
Coord  c1,
Coord  c2,
Coord  c3,
Coord  c4,
Coord  c5 
)
inline

Definition at line 143 of file sbasis.h.

◆ SBasis() [11/13]

Geom::SBasis::SBasis ( Coord  c0,
Coord  c1,
Coord  c2,
Coord  c3,
Coord  c4,
Coord  c5,
Coord  c6,
Coord  c7 
)
inline

Definition at line 153 of file sbasis.h.

◆ SBasis() [12/13]

Geom::SBasis::SBasis ( Coord  c0,
Coord  c1,
Coord  c2,
Coord  c3,
Coord  c4,
Coord  c5,
Coord  c6,
Coord  c7,
Coord  c8,
Coord  c9 
)
inline

Definition at line 166 of file sbasis.h.

◆ SBasis() [13/13]

template<typename Iter >
Geom::SBasis::SBasis ( Iter  first,
Iter  last 
)
inline

Definition at line 184 of file sbasis.h.

Member Function Documentation

◆ at()

Linear & Geom::SBasis::at ( unsigned  i)
inline

Definition at line 107 of file sbasis.h.

Referenced by Geom::compose_inverse(), and Geom::Piecewise< T >::unitVector().

◆ at0() [1/2]

Coord & Geom::SBasis::at0 ( )
inline

Definition at line 213 of file sbasis.h.

◆ at0() [2/2]

◆ at1() [1/2]

Coord & Geom::SBasis::at1 ( )
inline

Definition at line 215 of file sbasis.h.

◆ at1() [2/2]

◆ back() [1/2]

Linear & Geom::SBasis::back ( )
inline

Definition at line 88 of file sbasis.h.

◆ back() [2/2]

Linear const & Geom::SBasis::back ( ) const
inline

Definition at line 89 of file sbasis.h.

◆ begin() [1/2]

iterator Geom::SBasis::begin ( )
inline

Definition at line 85 of file sbasis.h.

◆ begin() [2/2]

const_iterator Geom::SBasis::begin ( ) const
inline

Definition at line 83 of file sbasis.h.

Referenced by divide_by_sk().

◆ clear()

void Geom::SBasis::clear ( )
inline

Definition at line 101 of file sbasis.h.

Referenced by Geom::bezier_to_sbasis(), and Geom::operator*=().

◆ degreesOfFreedom()

int Geom::SBasis::degreesOfFreedom ( ) const
inline

Definition at line 217 of file sbasis.h.

References size.

◆ derive()

void Geom::SBasis::derive ( )
private

Compute the derivative of this inplace (Exact)

Definition at line 350 of file sbasis.cpp.

References d, isZero(), pop_back(), and size().

Referenced by valueAndDerivatives().

◆ empty()

bool Geom::SBasis::empty ( ) const
inline

Definition at line 87 of file sbasis.h.

◆ end() [1/2]

iterator Geom::SBasis::end ( )
inline

Definition at line 86 of file sbasis.h.

◆ end() [2/2]

const_iterator Geom::SBasis::end ( ) const
inline

Definition at line 84 of file sbasis.h.

Referenced by divide_by_sk().

◆ insert()

void Geom::SBasis::insert ( iterator  before,
const_iterator  src_begin,
const_iterator  src_end 
)
inline

Definition at line 106 of file sbasis.h.

Referenced by divide_by_sk(), and Geom::truncate().

◆ isConstant()

bool Geom::SBasis::isConstant ( double  eps = EPSILON) const
inline

Definition at line 202 of file sbasis.h.

References size.

◆ isFinite()

bool Geom::SBasis::isFinite ( ) const

test all coefficients are finite

Definition at line 56 of file sbasis.cpp.

References size().

Referenced by TEST_F().

◆ isZero()

◆ normalize()

void Geom::SBasis::normalize ( )
inline

Definition at line 247 of file sbasis.h.

References size.

Referenced by Geom::integral(), integral(), Geom::multiply(), Geom::multiply_add(), my_inverse(), and Geom::poly_to_sbasis().

◆ operator!=()

bool Geom::SBasis::operator!= ( SBasis const &  B) const
inline

Definition at line 110 of file sbasis.h.

◆ operator()() [1/2]

double Geom::SBasis::operator() ( double  t) const
inline

Definition at line 232 of file sbasis.h.

◆ operator()() [2/2]

SBasis Geom::SBasis::operator() ( SBasis const &  g) const
inline

Definition at line 424 of file sbasis.h.

References Geom::compose().

◆ operator==()

bool Geom::SBasis::operator== ( SBasis const &  B) const
inline

Definition at line 109 of file sbasis.h.

◆ operator[]() [1/2]

Linear & Geom::SBasis::operator[] ( unsigned  i)
inline

Definition at line 82 of file sbasis.h.

◆ operator[]() [2/2]

Linear Geom::SBasis::operator[] ( unsigned  i) const
inline

Definition at line 79 of file sbasis.h.

◆ pop_back()

void Geom::SBasis::pop_back ( )
inline

Definition at line 90 of file sbasis.h.

Referenced by derive().

◆ push_back()

void Geom::SBasis::push_back ( Linear const &  l)
inlineprivate

Definition at line 72 of file sbasis.h.

Referenced by Geom::cheb(), Geom::chebyshev(), and TEST_F().

◆ reserve()

void Geom::SBasis::reserve ( unsigned  n)
inline

Definition at line 100 of file sbasis.h.

◆ resize() [1/2]

◆ resize() [2/2]

void Geom::SBasis::resize ( unsigned  n,
Linear const &  l 
)
inline

Definition at line 99 of file sbasis.h.

◆ size()

◆ tailError()

double Geom::SBasis::tailError ( unsigned  tail) const

bound the error from term truncation

Parameters
tailfirst term to chop
Returns
the largest possible error this truncation could give

Definition at line 49 of file sbasis.cpp.

References Geom::bounds_fast(), and bs.

Referenced by Geom::cos(), Geom::divide(), Geom::divide(), Geom::inverse(), Geom::Piecewise< T >::pw_compose_inverse(), pw_inverse(), Geom::sqrt(), Geom::sqrt_internal(), and Geom::Piecewise< T >::unitVector().

◆ toSBasis()

SBasis Geom::SBasis::toSBasis ( ) const
inline

Definition at line 238 of file sbasis.h.

◆ truncate()

void Geom::SBasis::truncate ( unsigned  k)
inline

◆ valueAndDerivatives()

std::vector< double > Geom::SBasis::valueAndDerivatives ( double  t,
unsigned  n 
) const

Compute the value and the first n derivatives.

Parameters
tposition to evaluate
nnumber of derivatives (not counting value)
Returns
a vector with the value and the n derivative evaluations

There is an elegant way to compute the value and n derivatives for a polynomial using a variant of horner's rule. Someone will someday work out how for sbasis.

Definition at line 71 of file sbasis.cpp.

References derive(), and valueAt().

◆ valueAt()

double Geom::SBasis::valueAt ( double  t) const
inline

Definition at line 219 of file sbasis.h.

References size.

Referenced by are_equal(), Geom::intersect(), portion(), TEST_F(), TEST_F(), and valueAndDerivatives().

Friends And Related Symbol Documentation

◆ portion()

SBasis portion ( const SBasis t,
double  from,
double  to 
)
related

Returns the sbasis on domain [0,1] that was t on [from, to].

Parameters
tsbasis function
from,tointerval
Returns
sbasis

Definition at line 475 of file sbasis.cpp.

References at0(), at1(), Geom::compose(), and valueAt().

Referenced by Geom::portion().

◆ reverse()

SBasis reverse ( SBasis const &  a)
related

Returns a function which reverses the domain of a.

Parameters
asbasis function

useful for reversing a parameteric curve.

Definition at line 271 of file sbasis.h.

References result, and reverse().

Referenced by reverse().

◆ valuation()

unsigned valuation ( SBasis const &  a,
double  tol = 0 
)
related

Returns the degree of the first non zero coefficient.

Parameters
asbasis function
tollargest abs val considered 0
Returns
first non zero coefficient

Definition at line 396 of file sbasis.h.

Member Data Documentation

◆ d

std::vector<Linear> Geom::SBasis::d
private

Definition at line 71 of file sbasis.h.

Referenced by derive().


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