STK++ 0.9.13
|
Compute the regression B-splines coefficients. More...
#include <STK_BSplineCoefficients.h>
Public Types | |
typedef IBasis< Data, ArrayXX > | Base |
![]() | |
typedef Data::Type | Type |
Public Member Functions | |
BSplineCoefficients (Data const *p_data=0, int nbControlPoints=1, int degree=3, Regress::KnotsPosition position=Regress::uniformKnotsPositions_, bool useDataValues=true) | |
Default constructor : initialize the data members with default values. | |
BSplineCoefficients (Data const &data, int nbControlPoints, int degree=3, Regress::KnotsPosition position=Regress::uniformKnotsPositions_, bool useDataValues=true) | |
Constructor : initialize the data members. | |
BSplineCoefficients (BSplineCoefficients const &coefs) | |
copy constructor. | |
virtual | ~BSplineCoefficients () |
Destructor. | |
BSplineCoefficients * | clone () const |
clone pattern implementation | |
virtual bool | run () |
run the computations. | |
int | degree () const |
int | nbKnots () const |
int | nbControlPoints () const |
VectorX const & | knots () const |
void | setNbControlPoints (int nbControlPoints) |
Set the number of control point (the number of BSpline) | |
void | setDim (int dim) |
Alias for setting the number of control point (the number of BSpline) | |
void | setDegree (int degree=3) |
Set the degree of the BSpline basis. | |
void | setPosition (Regress::KnotsPosition position) |
Set the kind of position to use for the knots. | |
void | setParameters (Data const &data, int nbControlPoints, int degree=3, Regress::KnotsPosition position=Regress::uniformKnotsPositions_) |
Set the whole set of parameters for computing the coefficients. | |
void | setData (Data const &data, int nbControlPoints, int degree=3, Regress::KnotsPosition position=Regress::uniformKnotsPositions_) |
[DEPRECATED] Set the whole set of parameters for computing the coefficients | |
template<class OtherVector > | |
ArrayXX | extrapolate (OtherVector const &x) const |
![]() | |
IBasis () | |
default constructor | |
IBasis (Data const *p_data, int dim, bool useDataValues=true) | |
constructor | |
IBasis (Data const &data, int dim, bool useDataValues=true) | |
constructor | |
IBasis (IBasis const &basis) | |
copy constructor. | |
virtual | ~IBasis () |
destructor | |
int | dim () const |
ArrayXX const & | coefficients () const |
Type | minValue () const |
Type | maxValue () const |
void | setData (Data const &data) |
Set the data set. | |
void | setDim (int dim) |
void | setMinValue (Type const &minValue) |
void | setMaxValue (Type const &maxValue) |
bool | initializeStep () |
Initialize the parameters minValue_ and maxValue_ using data set. | |
![]() | |
String const & | error () const |
get the last error message. | |
Protected Member Functions | |
bool | computeKnots () |
compute the position of the knots of the B-spline curves. | |
void | computeCoefficients () |
Compute the coefficients of the B-spline curves. | |
![]() | |
virtual void | update () |
update IBasis if a parameter or a new data set is set, update the state of this runner. | |
![]() | |
IRunnerBase () | |
default constructor | |
IRunnerBase (IRunnerBase const &runner) | |
copy constructor | |
virtual | ~IRunnerBase () |
destructor | |
Protected Attributes | |
int | degree_ |
degree of the B-splines curves. | |
Regress::KnotsPosition | position_ |
Method used in order to position the knots. | |
int | nbKnots_ |
number of knots of the B-spline curves. | |
int | lastControlPoint_ |
Index of the last control point of the B-spline curves. | |
VectorX | knots_ |
Data of the knots. | |
![]() | |
Data const * | p_data_ |
the input data set | |
int | dim_ |
number of dimension to build | |
bool | useDataValues_ |
Type | minValue_ |
Minimal value of the data. | |
Type | maxValue_ |
Maximal value of the data. | |
ArrayXX | coefficients_ |
Array2D of the coefficients. | |
![]() | |
String | msg_error_ |
String with the last error message. | |
bool | hasRun_ |
true if run has been used, false otherwise | |
Private Member Functions | |
void | computeUniformKnots () |
compute the position of the uniform knots. | |
void | computePeriodicKnots () |
compute the position of the periodic knots. | |
void | computeDensityKnots (bool isSorted) |
compute the position of the density knots | |
void | computeCoefficientsRow (int irow, Real const &value) |
Compute a row of the coefficients matrix for a given value. | |
Compute the regression B-splines coefficients.
The BSplineCoefficients class computes the coefficients of a BSpline curve using the de Boor's algorithm. The knots can be uniform (the default), periodic or density placed.
Given the number of control points and the degree of the B-splines, the number of knots is given by the formula nbKnots = nbControlPoints + degree + 1.
n
the output matrix of the coefficients Coefficients()
is a matrix of size
(n, nbControlPoints). Definition at line 62 of file STK_BSplineCoefficients.h.
typedef IBasis<Data, ArrayXX> STK::BSplineCoefficients< Data >::Base |
Definition at line 65 of file STK_BSplineCoefficients.h.
STK::BSplineCoefficients< Data >::BSplineCoefficients | ( | Data const * | p_data = 0 , |
int | nbControlPoints = 1 , |
||
int | degree = 3 , |
||
Regress::KnotsPosition | position = Regress::uniformKnotsPositions_ , |
||
bool | useDataValues = true |
||
) |
Default constructor : initialize the data members with default values.
The number of knots is given by the formula nbKnots = nbControlPoints + degree +1.
p_data | the input data values |
nbControlPoints | number of control points |
degree | degree of the B-spline curves |
position | method to use for positioning the knots |
useDataValues | if true use data in order to find the minValue_ and maxValue_, use values set otherwise. |
Definition at line 209 of file STK_BSplineCoefficients.h.
STK::BSplineCoefficients< Data >::BSplineCoefficients | ( | Data const & | data, |
int | nbControlPoints, | ||
int | degree = 3 , |
||
Regress::KnotsPosition | position = Regress::uniformKnotsPositions_ , |
||
bool | useDataValues = true |
||
) |
Constructor : initialize the data members.
The number of knots is given by the formula nbKnots = nbControlPoints + degree +1.
data | the input data values |
nbControlPoints | number of control points |
degree | degree of the B-spline curves |
position | method to use for positioning the knots |
useDataValues | if true use data in order to find the minValue_ and maxValue_, use values set otherwise. |
Definition at line 225 of file STK_BSplineCoefficients.h.
STK::BSplineCoefficients< Data >::BSplineCoefficients | ( | BSplineCoefficients< Data > const & | coefs | ) |
copy constructor.
coefs | the coefficients to copy |
Definition at line 242 of file STK_BSplineCoefficients.h.
|
inlinevirtual |
|
inline |
clone pattern implementation
Definition at line 113 of file STK_BSplineCoefficients.h.
|
protected |
Compute the coefficients of the B-spline curves.
Definition at line 442 of file STK_BSplineCoefficients.h.
|
private |
Compute a row of the coefficients matrix for a given value.
irow | index of the row |
value | the value to which we want to compute the row |
Definition at line 515 of file STK_BSplineCoefficients.h.
|
private |
compute the position of the density knots
isSorted | true if the data is sorted, false otherwise |
Definition at line 486 of file STK_BSplineCoefficients.h.
|
protected |
compute the position of the knots of the B-spline curves.
Definition at line 406 of file STK_BSplineCoefficients.h.
References STK::BSplineCoefficients< Data >::computeKnots(), STK::Regress::densityKnotsPositions_, STK::IRunnerBase::msg_error_, STK::Regress::periodicKnotsPositions_, STKERROR_NO_ARG, and STK::Regress::uniformKnotsPositions_.
Referenced by STK::BSplineCoefficients< Data >::computeKnots().
|
private |
|
private |
compute the position of the uniform knots.
Definition at line 459 of file STK_BSplineCoefficients.h.
|
inline |
Definition at line 118 of file STK_BSplineCoefficients.h.
References STK::BSplineCoefficients< Data >::degree_.
ArrayXX STK::BSplineCoefficients< Data >::extrapolate | ( | OtherVector const & | x | ) | const |
x | the values to extrapolate |
Definition at line 354 of file STK_BSplineCoefficients.h.
References STK::MultidimRegression< Array, Weight >::coefs(), STK::BSplineCoefficients< Data >::extrapolate(), STK::IRunnerBase::hasRun_, STK::IRegression< Array, Array, Weight >::run(), and STKRUNTIME_ERROR_NO_ARG.
Referenced by STK::BSplineCoefficients< Data >::extrapolate().
|
inline |
Definition at line 124 of file STK_BSplineCoefficients.h.
References STK::BSplineCoefficients< Data >::knots_.
Referenced by STK::BSplineRegression< YArray, XVector, Weights >::knots().
|
inline |
Definition at line 122 of file STK_BSplineCoefficients.h.
References STK::IBasis< Data, ArrayXX >::dim_.
|
inline |
Definition at line 120 of file STK_BSplineCoefficients.h.
References STK::BSplineCoefficients< Data >::nbKnots_.
|
virtual |
run the computations.
Implements STK::IRunnerBase.
Definition at line 331 of file STK_BSplineCoefficients.h.
References STK::IRunnerBase::hasRun_, STK::IRegression< Array, Array, Weight >::initializeStep(), STK::IRunnerBase::msg_error_, STK::BSplineCoefficients< Data >::run(), and STKERROR_NO_ARG.
Referenced by STK::BSplineCoefficients< Data >::run().
void STK::BSplineCoefficients< Data >::setData | ( | Data const & | data, |
int | nbControlPoints, | ||
int | degree = 3 , |
||
Regress::KnotsPosition | position = Regress::uniformKnotsPositions_ |
||
) |
[DEPRECATED] Set the whole set of parameters for computing the coefficients
data | the input data values |
nbControlPoints | number of control points |
degree | degree of the B-spline curves (default is 3) |
position | method to use for positioning the knots (default is uniform) |
Definition at line 257 of file STK_BSplineCoefficients.h.
References STK::IRunnerBase::update().
void STK::BSplineCoefficients< Data >::setDegree | ( | int | degree = 3 | ) |
Set the degree of the BSpline basis.
degree | degree of the B-spline curves (default is 3) |
Definition at line 309 of file STK_BSplineCoefficients.h.
References STK::IRunnerBase::update().
|
inline |
Alias for setting the number of control point (the number of BSpline)
dim | number of control points |
Definition at line 133 of file STK_BSplineCoefficients.h.
References STK::IBasis< Data, ArrayXX >::dim(), and STK::BSplineCoefficients< Data >::setNbControlPoints().
void STK::BSplineCoefficients< Data >::setNbControlPoints | ( | int | nbControlPoints | ) |
Set the number of control point (the number of BSpline)
nbControlPoints | number of control points |
Definition at line 296 of file STK_BSplineCoefficients.h.
References STK::IRunnerBase::update().
Referenced by STK::BSplineCoefficients< Data >::setDim().
void STK::BSplineCoefficients< Data >::setParameters | ( | Data const & | data, |
int | nbControlPoints, | ||
int | degree = 3 , |
||
Regress::KnotsPosition | position = Regress::uniformKnotsPositions_ |
||
) |
Set the whole set of parameters for computing the coefficients.
data | the input data values |
nbControlPoints | number of control points |
degree | degree of the B-spline curves (default is 3) |
position | method to use for positioning the knots (default is uniform) |
Definition at line 276 of file STK_BSplineCoefficients.h.
References STK::IRunnerBase::update().
void STK::BSplineCoefficients< Data >::setPosition | ( | Regress::KnotsPosition | position | ) |
Set the kind of position to use for the knots.
position | method to use for positioning the knots (default is uniform) |
Definition at line 322 of file STK_BSplineCoefficients.h.
References STK::IRunnerBase::update().
|
protected |
degree of the B-splines curves.
Definition at line 174 of file STK_BSplineCoefficients.h.
Referenced by STK::BSplineCoefficients< Data >::degree().
|
protected |
Data of the knots.
Definition at line 184 of file STK_BSplineCoefficients.h.
Referenced by STK::BSplineCoefficients< Data >::knots().
|
protected |
Index of the last control point of the B-spline curves.
This is dim_ - 1.
Definition at line 182 of file STK_BSplineCoefficients.h.
|
protected |
number of knots of the B-spline curves.
Definition at line 178 of file STK_BSplineCoefficients.h.
Referenced by STK::BSplineCoefficients< Data >::nbKnots().
|
protected |
Method used in order to position the knots.
Definition at line 176 of file STK_BSplineCoefficients.h.