clipper
Classes | Defines | Functions | Variables
clipper.cc File Reference
#include <stdlib.h>
#include <assert.h>
#include <getopt.h>
#include <sys/time.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <sstream>
#include <stdexcept>
#include <cmath>
#include <limits>
#include <mpfr.h>

Go to the source code of this file.

Classes

class  Fraction
 Contains a pair of doubles signifying the numerator and denominator of a fraction. More...
class  Double< Type >
 Implements a wrapper around one of the hardware floating-point data types so that these can be used as a "Numeric" template parameter. More...
class  MpfrFloat
 Wraps a mpfr_t object of the multiple-precision floating-pointer number library mpfr into a Numeric object and provides all necessary operators and functions for further calculations. More...
class  Polynomial< Numeric >
 Base class for following polynomials in different bases. More...
class  PolynomialStandard< Numeric >
 Represents a polynomial in standard monomial base. More...
class  PolynomialBezier< Numeric >
 Represents a polynomial in the Bernstein-Bezier basis using Bezier coefficients. More...
class  Matrix< Numeric >
 Implements a simple matrix that can be filled using a functional object. More...
class  DegreeInterpolationGenerator< Numeric >
 Functional class to calculate the entries of the degree reducing or raising matrices. More...
class  BezierClip< Numeric >
 Implements the BezierClip algorithm. More...
class  KClip< Numeric >
 Implements the K-Clip algorithm. More...

Defines

#define dbg(X)   do { if (!output_latex) std::cout << X; } while(0)
#define ltx(X)   do { if (output_latex) std::cout << X; } while(0)
#define spd(X)   dbg(X)
#define ASSERT(x)
#define CHKSTR(p, str)

Functions

template<typename Type >
std::string S (Type i)
 format many different types as strings
std::string ltxNum (std::string os)
 format a number converting "e+10" to latex math strings
template<typename Numeric >
std::string ltxNum (Numeric n)
 format a number converting "e+10" to latex math strings
template<typename Numeric >
std::string ltxInterval (Numeric l, Numeric r)
 format interval in latex headers
double timestamp ()
 time measuring using gettimeofday().
template<typename Type >
Double< Type > operator- (const double &a, const Double< Type > &b)
template<typename Type >
Double< Type > operator* (const double &a, const Double< Type > &b)
template<typename Type >
Double< Type > abs (const Double< Type > &v)
template<typename Type >
Double< Type > sqrt (const Double< Type > &v)
Double< float > cbrt (const Double< float > &v)
Double< double > cbrt (const Double< double > &v)
Double< long double > cbrt (const Double< long double > &v)
template<typename Type >
Double< Type > cos (const Double< Type > &v)
template<typename Type >
Double< Type > acos (const Double< Type > &v)
template<typename Type , typename Exponent >
Double< Type > pow (const Double< Type > &v, Exponent e)
template<typename Type >
int isnormal (const Double< Type > &v)
MpfrFloat operator- (const double &a, const MpfrFloat &b)
MpfrFloat operator* (const double &a, const MpfrFloat &b)
MpfrFloat abs (const MpfrFloat &v)
MpfrFloat sqrt (const MpfrFloat &v)
MpfrFloat cbrt (const MpfrFloat &v)
MpfrFloat cos (const MpfrFloat &v)
MpfrFloat acos (const MpfrFloat &v)
MpfrFloat pow (const MpfrFloat &v, long int e)
int isnormal (const MpfrFloat &v)
template<typename Numeric >
void testsuite ()
template<typename Clipper , typename Numeric >
double runSpeedtest (unsigned int iterations, Clipper &clipper, const PolynomialStandard< Numeric > &p, double left, double right)
template<typename Numeric >
void runAllClippers (const std::string &name, unsigned int iterations, const PolynomialStandard< Numeric > &p, int epsexp, double left=0.0, double right=1.0)
template<typename Numeric >
void runDemo6 ()
template<typename Numeric >
void runDemo7 ()
template<typename Numeric >
void runDemo8 ()
void runDemo (unsigned int demo)
void printLatexPreamble ()
void printUsage (char *argv[])
bool isCoefficient (const char *s)
int main (int argc, char *argv[])

Variables

unsigned int output_latex = false
bool debug_more = false
unsigned int print_precision = 6

Define Documentation

#define ASSERT (   x)
Value:
do { if (!(x)) {                                             \
        std::cout << "Testsuite assertion \"" #x "\" on line "   \
                  << __LINE__ << " failed!\n";                   \
        abort();                                                 \
        }                                                        \
    } while(0)

Definition at line 2568 of file clipper.cc.

#define CHKSTR (   p,
  str 
)
Value:
do { if (p.toString() != str) {                             \
        std::cout << "Testsuite error: "                        \
                  << p.toString() << " != " << str << "\n";     \
        ASSERT(p.toString() == str);                            \
        }                                                       \
    } while(0)

Definition at line 2576 of file clipper.cc.

#define dbg (   X)    do { if (!output_latex) std::cout << X; } while(0)

Definition at line 91 of file clipper.cc.

#define ltx (   X)    do { if (output_latex) std::cout << X; } while(0)

Definition at line 92 of file clipper.cc.

#define spd (   X)    dbg(X)

Definition at line 93 of file clipper.cc.


Function Documentation

template<typename Type >
Double<Type> abs ( const Double< Type > &  v) [inline]

Definition at line 464 of file clipper.cc.

MpfrFloat abs ( const MpfrFloat v) [inline]

Definition at line 709 of file clipper.cc.

template<typename Type >
Double<Type> acos ( const Double< Type > &  v) [inline]

Definition at line 497 of file clipper.cc.

MpfrFloat acos ( const MpfrFloat v) [inline]

Definition at line 729 of file clipper.cc.

Double<float> cbrt ( const Double< float > &  v) [inline]

Definition at line 475 of file clipper.cc.

Double<double> cbrt ( const Double< double > &  v) [inline]

Definition at line 480 of file clipper.cc.

Double<long double> cbrt ( const Double< long double > &  v) [inline]

Definition at line 485 of file clipper.cc.

MpfrFloat cbrt ( const MpfrFloat v) [inline]

Definition at line 719 of file clipper.cc.

template<typename Type >
Double<Type> cos ( const Double< Type > &  v) [inline]

Definition at line 491 of file clipper.cc.

MpfrFloat cos ( const MpfrFloat v) [inline]

Definition at line 724 of file clipper.cc.

bool isCoefficient ( const char *  s)

Definition at line 3344 of file clipper.cc.

template<typename Type >
int isnormal ( const Double< Type > &  v) [inline]

Definition at line 527 of file clipper.cc.

int isnormal ( const MpfrFloat v) [inline]

Definition at line 739 of file clipper.cc.

template<typename Numeric >
std::string ltxInterval ( Numeric  l,
Numeric  r 
)

format interval in latex headers

Definition at line 151 of file clipper.cc.

std::string ltxNum ( std::string  os)

format a number converting "e+10" to latex math strings

Definition at line 121 of file clipper.cc.

template<typename Numeric >
std::string ltxNum ( Numeric  n)

format a number converting "e+10" to latex math strings

Definition at line 144 of file clipper.cc.

int main ( int  argc,
char *  argv[] 
)

Definition at line 3365 of file clipper.cc.

template<typename Type >
Double<Type> operator* ( const double &  a,
const Double< Type > &  b 
) [inline]

Definition at line 458 of file clipper.cc.

MpfrFloat operator* ( const double &  a,
const MpfrFloat b 
) [inline]

Definition at line 704 of file clipper.cc.

template<typename Type >
Double<Type> operator- ( const double &  a,
const Double< Type > &  b 
) [inline]

Definition at line 452 of file clipper.cc.

MpfrFloat operator- ( const double &  a,
const MpfrFloat b 
) [inline]

Definition at line 699 of file clipper.cc.

template<typename Type , typename Exponent >
Double<Type> pow ( const Double< Type > &  v,
Exponent  e 
) [inline]

Definition at line 503 of file clipper.cc.

MpfrFloat pow ( const MpfrFloat v,
long int  e 
) [inline]

Definition at line 734 of file clipper.cc.

Definition at line 3278 of file clipper.cc.

void printUsage ( char *  argv[])

Definition at line 3325 of file clipper.cc.

template<typename Numeric >
void runAllClippers ( const std::string &  name,
unsigned int  iterations,
const PolynomialStandard< Numeric > &  p,
int  epsexp,
double  left = 0.0,
double  right = 1.0 
)

Definition at line 2886 of file clipper.cc.

void runDemo ( unsigned int  demo)

Definition at line 3015 of file clipper.cc.

template<typename Numeric >
void runDemo6 ( )

Definition at line 2921 of file clipper.cc.

template<typename Numeric >
void runDemo7 ( )

Definition at line 2954 of file clipper.cc.

template<typename Numeric >
void runDemo8 ( )

Definition at line 2981 of file clipper.cc.

template<typename Clipper , typename Numeric >
double runSpeedtest ( unsigned int  iterations,
Clipper &  clipper,
const PolynomialStandard< Numeric > &  p,
double  left,
double  right 
)

Definition at line 2868 of file clipper.cc.

template<typename Type >
std::string S ( Type  i)

format many different types as strings

Definition at line 113 of file clipper.cc.

template<typename Type >
Double<Type> sqrt ( const Double< Type > &  v) [inline]

Definition at line 470 of file clipper.cc.

MpfrFloat sqrt ( const MpfrFloat v) [inline]

Definition at line 714 of file clipper.cc.

template<typename Numeric >
void testsuite ( )

Definition at line 2585 of file clipper.cc.

double timestamp ( ) [inline]

time measuring using gettimeofday().

Definition at line 159 of file clipper.cc.


Variable Documentation

bool debug_more = false

Definition at line 104 of file clipper.cc.

unsigned int output_latex = false

Definition at line 87 of file clipper.cc.

unsigned int print_precision = 6

Definition at line 105 of file clipper.cc.

 All Classes Files Functions Variables Typedefs Friends Defines