ndcurves 2.1.0
create and manipulate spline and bezier curves.
Loading...
Searching...
No Matches
ndcurves::linear_variable< Numeric, Safe > Struct Template Reference

#include <ndcurves/linear_variable.h>

Inheritance diagram for ndcurves::linear_variable< Numeric, Safe >:
ndcurves::serialization::Serializable

Public Types

typedef Eigen::Matrix< Numeric, Eigen::Dynamic, 1 > vector_x_t
typedef Eigen::Matrix< Numeric, Eigen::Dynamic, Eigen::Dynamic > matrix_x_t
typedef Eigen::Matrix< Numeric, 3, 1 > vector_3_t
typedef Eigen::Matrix< Numeric, 3, 3 > matrix_3_t
typedef linear_variable< Numeric > linear_variable_t

Public Member Functions

 linear_variable ()
 linear_variable (const vector_x_t &c)
 linear_variable (const matrix_x_t &B, const vector_x_t &c)
 linear_variable (const linear_variable_t &other)
 ~linear_variable ()
vector_x_t operator() (const Eigen::Ref< const vector_x_t > &val) const
 Linear evaluation for vector x.
linear_variable_toperator+= (const linear_variable_t &w1)
 Add another linear variable.
linear_variable_toperator-= (const linear_variable_t &w1)
 Substract another linear variable.
linear_variable_toperator/= (const double d)
 Divide by a constant : p_i / d = B_i*x/d + c_i/d.
linear_variable_toperator*= (const double d)
 Multiply by a constant : p_i / d = B_i*x*d + c_i*d.
linear_variable_t cross (const linear_variable_t &other) const
 Compute the cross product of the current linear_variable and the other. This method of course only makes sense for dimension 3 curves and dimension 3 unknown, since otherwise the result is non-linear. It assumes that a method point_t cross(const point_t&, const point_t&) has been defined.
std::size_t size () const
 Get dimension of linear variable.
Numeric norm () const
 Get norm of linear variable (Norm of B plus norm of C).
bool isApprox (const linear_variable_t &other, const double prec=Eigen::NumTraits< Numeric >::dummy_precision()) const
 Check if actual linear variable and other are approximately equal given a precision threshold. Only two curves of the same class can be approximately equal,.
virtual bool operator== (const linear_variable &other) const
 Check if actual linear variable and other are equal.
virtual bool operator!= (const linear_variable &other) const
 Check if actual linear variable and other are different.
const matrix_x_tB () const
const vector_x_tc () const
bool isZero () const
template<class Archive>
void serialize (Archive &ar, const unsigned int version)
linear_variableoperator= (const linear_variable &other)
Public Member Functions inherited from ndcurves::serialization::Serializable
template<class Derived>
void loadFromText (const std::string &filename)
 Loads a Derived object from a text file.
template<class Derived>
void saveAsText (const std::string &filename) const
 Saved a Derived object as a text file.
template<class Derived>
void loadFromXML (const std::string &filename, const std::string &tag_name)
 Loads a Derived object from an XML file.
template<class Derived>
void saveAsXML (const std::string &filename, const std::string &tag_name) const
 Saved a Derived object as an XML file.
template<class Derived>
void loadFromBinary (const std::string &filename)
 Loads a Derived object from an binary file.
template<class Derived>
void saveAsBinary (const std::string &filename) const
 Saved a Derived object as an binary file.

Static Public Member Functions

static linear_variable_t Zero (size_t dim=0)
 Get a linear variable equal to zero.
static linear_variable_t X (size_t dim=0)
 Get a linear variable equal to the variable.

Friends

class boost::serialization::access

Member Typedef Documentation

◆ linear_variable_t

template<typename Numeric = double, bool Safe = true>
typedef linear_variable<Numeric> ndcurves::linear_variable< Numeric, Safe >::linear_variable_t

◆ matrix_3_t

template<typename Numeric = double, bool Safe = true>
typedef Eigen::Matrix<Numeric, 3, 3> ndcurves::linear_variable< Numeric, Safe >::matrix_3_t

◆ matrix_x_t

template<typename Numeric = double, bool Safe = true>
typedef Eigen::Matrix<Numeric, Eigen::Dynamic, Eigen::Dynamic> ndcurves::linear_variable< Numeric, Safe >::matrix_x_t

◆ vector_3_t

template<typename Numeric = double, bool Safe = true>
typedef Eigen::Matrix<Numeric, 3, 1> ndcurves::linear_variable< Numeric, Safe >::vector_3_t

◆ vector_x_t

template<typename Numeric = double, bool Safe = true>
typedef Eigen::Matrix<Numeric, Eigen::Dynamic, 1> ndcurves::linear_variable< Numeric, Safe >::vector_x_t

Constructor & Destructor Documentation

◆ linear_variable() [1/4]

template<typename Numeric = double, bool Safe = true>
ndcurves::linear_variable< Numeric, Safe >::linear_variable()
inline

◆ linear_variable() [2/4]

template<typename Numeric = double, bool Safe = true>
ndcurves::linear_variable< Numeric, Safe >::linear_variable(const vector_x_t &c)
inline

◆ linear_variable() [3/4]

template<typename Numeric = double, bool Safe = true>
ndcurves::linear_variable< Numeric, Safe >::linear_variable(const matrix_x_t &B,
const vector_x_t &c )
inline

◆ linear_variable() [4/4]

template<typename Numeric = double, bool Safe = true>
ndcurves::linear_variable< Numeric, Safe >::linear_variable(const linear_variable_t &other)
inline

◆ ~linear_variable()

template<typename Numeric = double, bool Safe = true>
ndcurves::linear_variable< Numeric, Safe >::~linear_variable()
inline

Member Function Documentation

◆ B()

template<typename Numeric = double, bool Safe = true>
const matrix_x_t & ndcurves::linear_variable< Numeric, Safe >::B()const
inline

◆ c()

template<typename Numeric = double, bool Safe = true>
const vector_x_t & ndcurves::linear_variable< Numeric, Safe >::c()const
inline

◆ cross()

template<typename Numeric = double, bool Safe = true>
linear_variable_t ndcurves::linear_variable< Numeric, Safe >::cross(const linear_variable_t &other)const
inline

Compute the cross product of the current linear_variable and the other. This method of course only makes sense for dimension 3 curves and dimension 3 unknown, since otherwise the result is non-linear. It assumes that a method point_t cross(const point_t&, const point_t&) has been defined.

Parameters
pOtherother polynomial to compute the cross product with.
Returns
a new polynomial defining the cross product between this and other

◆ isApprox()

template<typename Numeric = double, bool Safe = true>
bool ndcurves::linear_variable< Numeric, Safe >::isApprox(const linear_variable_t &other,
const doubleprec = Eigen::NumTraits<Numeric>::dummy_precision() ) const
inline

Check if actual linear variable and other are approximately equal given a precision threshold. Only two curves of the same class can be approximately equal,.

Parameters
prec: the precision threshold, default Eigen::NumTraits<Numeric>::dummy_precision()
Returns
true if the two linear variables are approximately equal.

◆ isZero()

template<typename Numeric = double, bool Safe = true>
bool ndcurves::linear_variable< Numeric, Safe >::isZero()const
inline

◆ norm()

template<typename Numeric = double, bool Safe = true>
Numeric ndcurves::linear_variable< Numeric, Safe >::norm()const
inline

Get norm of linear variable (Norm of B plus norm of C).

Returns
Norm of linear variable.

◆ operator!=()

template<typename Numeric = double, bool Safe = true>
virtual bool ndcurves::linear_variable< Numeric, Safe >::operator!=(const linear_variable< Numeric, Safe > &other)const
inlinevirtual

Check if actual linear variable and other are different.

Parameters
other: the other linear_variable to check.
Returns
true if the two linear_variable are different.

◆ operator()()

template<typename Numeric = double, bool Safe = true>
vector_x_t ndcurves::linear_variable< Numeric, Safe >::operator()(const Eigen::Ref< const vector_x_t > &val)const
inline

Linear evaluation for vector x.

Parameters
val: vector to evaluate the linear variable.
Returns
Evaluation of linear variable for vector x.

◆ operator*=()

template<typename Numeric = double, bool Safe = true>
linear_variable_t & ndcurves::linear_variable< Numeric, Safe >::operator*=(const doubled)
inline

Multiply by a constant : p_i / d = B_i*x*d + c_i*d.

Parameters
d: constant.
Returns
Linear variable after operation.

◆ operator+=()

template<typename Numeric = double, bool Safe = true>
linear_variable_t & ndcurves::linear_variable< Numeric, Safe >::operator+=(const linear_variable_t &w1)
inline

Add another linear variable.

Parameters
w1: linear variable to add.
Returns
Linear variable after operation.

◆ operator-=()

template<typename Numeric = double, bool Safe = true>
linear_variable_t & ndcurves::linear_variable< Numeric, Safe >::operator-=(const linear_variable_t &w1)
inline

Substract another linear variable.

Parameters
w1: linear variable to substract.
Returns
Linear variable after operation.

◆ operator/=()

template<typename Numeric = double, bool Safe = true>
linear_variable_t & ndcurves::linear_variable< Numeric, Safe >::operator/=(const doubled)
inline

Divide by a constant : p_i / d = B_i*x/d + c_i/d.

Parameters
d: constant.
Returns
Linear variable after operation.

◆ operator=()

template<typename Numeric = double, bool Safe = true>
linear_variable & ndcurves::linear_variable< Numeric, Safe >::operator=(const linear_variable< Numeric, Safe > &other)
inline

◆ operator==()

template<typename Numeric = double, bool Safe = true>
virtual bool ndcurves::linear_variable< Numeric, Safe >::operator==(const linear_variable< Numeric, Safe > &other)const
inlinevirtual

Check if actual linear variable and other are equal.

Parameters
other: the other linear_variable to check.
Returns
true if the two linear_variable are equals.

◆ serialize()

template<typename Numeric = double, bool Safe = true>
template<class Archive>
void ndcurves::linear_variable< Numeric, Safe >::serialize(Archive &ar,
const unsigned intversion )
inline

◆ size()

template<typename Numeric = double, bool Safe = true>
std::size_t ndcurves::linear_variable< Numeric, Safe >::size()const
inline

Get dimension of linear variable.

Returns
Dimension of linear variable.

◆ X()

template<typename Numeric = double, bool Safe = true>
linear_variable_t ndcurves::linear_variable< Numeric, Safe >::X(size_tdim = 0)
inlinestatic

Get a linear variable equal to the variable.

Parameters
dim: Dimension of linear variable.
Returns
Linear variable equal to the variable.

◆ Zero()

template<typename Numeric = double, bool Safe = true>
linear_variable_t ndcurves::linear_variable< Numeric, Safe >::Zero(size_tdim = 0)
inlinestatic

Get a linear variable equal to zero.

Parameters
dim: Dimension of linear variable.
Returns
Linear variable equal to zero.

◆ boost::serialization::access

template<typename Numeric = double, bool Safe = true>
friend class boost::serialization::access
friend

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