Templates -- Meow  1.1.2
不能,也不應該先編譯成obj-file的templates
meow::BallProjection< Scalar > Class Template Reference

A ball projection is to project the given vector to a hyper-sphere. More...

#include "Transformations.h"

Inheritance diagram for meow::BallProjection< Scalar >:
meow::Transformation< Scalar >

Public Member Functions

 BallProjection (BallProjection const &b)
 
 BallProjection (size_t d)
 
 BallProjection (size_t d, Scalar const &r)
 
BallProjectioncopyFrom (BallProjection const &b)
 Copy settings from another one. More...
 
BallProjectionreferenceFrom (BallProjection const &b)
 Reference settings from another one. More...
 
Scalar parameter (size_t i) const
 same as radius() More...
 
Scalar parameter (size_t i, Scalar const &s)
 same as radius(s) More...
 
Scalar radius () const
 Return the value of the radius. More...
 
Scalar radius (Scalar const &r)
 Setup the radius. More...
 
size_t dimension () const
 Get the dimension of this projection. More...
 
Matrix< Scalar > transformate (Matrix< Scalar > const &x) const
 Project the input vector(s) onto the hyper-sphere and return it. More...
 
Matrix< Scalar > jacobian (Matrix< Scalar > const &x) const
 Return the jacobian matrix (derivate by the input vector) of this projection. More...
 
Matrix< Scalar > jacobian (Matrix< Scalar > const &x, size_t i) const
 Return the jacobian matrix (derivate by radius) of this projection. More...
 
BallProjectionoperator= (BallProjection const &b)
 Same as copyFrom(b) More...
 
Matrix< Scalar > operator() (Matrix< Scalar > const &v) const
 Same as transformate(v) More...
 
- Public Member Functions inherited from meow::Transformation< Scalar >
virtual ~Transformation ()
 
size_t inputRows () const
 Return the number of rows of the input matrix. More...
 
size_t inputCols () const
 Return the number of columns of the input matrix. More...
 
size_t outputRows () const
 Return the number of rows of the output matrix. More...
 
size_t outputCols () const
 Return the number of columns of the output matrix. More...
 
size_t parameterSize () const
 Return the number of parameters. More...
 
virtual bool inversable () const
 Return whether this transformation is inversable or not. More...
 
virtual Matrix< Scalar > transformateInv (Matrix< Scalar > const &x) const
 Do the inverse transformation. More...
 
virtual Matrix< Scalar > jacobianInv (Matrix< Scalar > const &x) const
 Return the jacobian matrix of the inverse transformation. More...
 
virtual Matrix< Scalar > jacobianInv (Matrix< Scalar > const &x, size_t i) const
 Return the jacobian matrix of the inverse transformation. More...
 

Additional Inherited Members

- Protected Member Functions inherited from meow::Transformation< Scalar >
 Transformation (size_t inputRows, size_t inputCols, size_t outputRows, size_t outputCols, size_t psize)
 
 Transformation (Transformation const &b)
 
TransformationcopyFrom (Transformation const &b)
 Copy from the specified one. More...
 
TransformationreferenceFrom (Transformation const &b)
 reference from the specified one More...
 

Detailed Description

template<class Scalar>
class meow::BallProjection< Scalar >

A ball projection is to project the given vector to a hyper-sphere.

Assume:

  • The dimension of a ball projection is $ N $
  • The radius of the hyper-sphere is $ R $

Then the transformation is like below:

\[ \left[ \begin{array}{c} x_1 \\ x_2 \\ x_3 \\ . \\ . \\ . \\ x_N \\ \end{array} \right] \stackrel{transformate}{\rightarrow} \left[ \begin{array}{c} \frac{x_1 \times R}{L} \\ \frac{x_2 \times R}{L} \\ \frac{x_3 \times R}{L} \\ . \\ . \\ . \\ \frac{x_N \times R}{L} \\ \end{array} \right] \\ \]

where $ L=\sqrt{x_1^2 + x_2^2 + x_3^2 + ... + x_N^2 } $

Author
cat_leopard

Constructor & Destructor Documentation

template<class Scalar >
meow::BallProjection< Scalar >::BallProjection ( BallProjection< Scalar > const &  b)
inline

Constructor, copy settings from given BallProjection

Parameters
[in]banother ball projection class
template<class Scalar >
meow::BallProjection< Scalar >::BallProjection ( size_t  d)
inline

Constructor and setup, radius = 1

Parameters
[in]dDimension of the input/output vector
template<class Scalar >
meow::BallProjection< Scalar >::BallProjection ( size_t  d,
Scalar const &  r 
)
inline

Constructor and setup

Parameters
[in]dDimension of the input/output vector
[in]rRadius of the hyper-sphere

Member Function Documentation

template<class Scalar >
BallProjection& meow::BallProjection< Scalar >::copyFrom ( BallProjection< Scalar > const &  b)
inline

Copy settings from another one.

Parameters
[in]bAnother one
Returns
*this
template<class Scalar >
size_t meow::BallProjection< Scalar >::dimension ( ) const
inline

Get the dimension of this projection.

template<class Scalar >
Matrix<Scalar> meow::BallProjection< Scalar >::jacobian ( Matrix< Scalar > const &  x) const
inlinevirtual

Return the jacobian matrix (derivate by the input vector) of this projection.

This method only allow a vector-like matrix be input. Assume:

  • The dimension of a ball projection is $ N $
  • The length of the input vector is $ L=\sqrt{x_1^2+x_2^2+...+x_N^2} $
  • The radius of the hyper-sphere is $ R $

Then the jacobian matrix is like below:

\[ \frac{R}{L^3} \times \left[ \begin{array}{ccccc} L^2-x_1^2 & -x_1x_2 & -x_1x_3 & ... & -x_1x_N \\ -x_2x_1 & L^2-x_2^2 & -x_2x_3 & ... & -x_2x_N \\ -x_3x_1 & -x_3x_2 & L^2-x_3^2 & ... & -x_3x_N \\ . & . & . & & . \\ . & . & . & & . \\ . & . & . & & . \\ -x_Nx_1 & -x_Nx_2 & -x_Nx_3 & ... & L^2-x_N^2 \\ \end{array} \right] \]

Parameters
[in]xThe input matrix.
Returns
The output matrix.

Reimplemented from meow::Transformation< Scalar >.

template<class Scalar >
Matrix<Scalar> meow::BallProjection< Scalar >::jacobian ( Matrix< Scalar > const &  x,
size_t  i 
) const
inlinevirtual

Return the jacobian matrix (derivate by radius) of this projection.

This method only allow a vector-like matrix be input. Assume:

  • The dimension of a ball projection is $ N $
  • The length of the input vector is $ L=\sqrt{x_1^2+x_2^2+...+x_N^2} $
  • The radius of the hyper-sphere is $ R $

Then the jacobian matrix is like below:

\[ R \times \left[ \begin{array}{c} \frac{x_1}{L} \\ \frac{x_2}{L} \\ \frac{x_3}{L} \\ . \\ . \\ . \\ \frac{x_N}{L} \\ \end{array} \right] \]

Parameters
[in]xThe input matrix.
[in]iUseless parameter
Returns
The output matrix.

Reimplemented from meow::Transformation< Scalar >.

template<class Scalar >
Matrix<Scalar> meow::BallProjection< Scalar >::operator() ( Matrix< Scalar > const &  v) const
inline

Same as transformate(v)

template<class Scalar >
BallProjection& meow::BallProjection< Scalar >::operator= ( BallProjection< Scalar > const &  b)
inline

Same as copyFrom(b)

template<class Scalar >
Scalar meow::BallProjection< Scalar >::parameter ( size_t  i) const
inlinevirtual
template<class Scalar >
Scalar meow::BallProjection< Scalar >::parameter ( size_t  i,
Scalar const &  s 
)
inlinevirtual

same as radius(s)

Implements meow::Transformation< Scalar >.

template<class Scalar >
Scalar meow::BallProjection< Scalar >::radius ( ) const
inline

Return the value of the radius.

template<class Scalar >
Scalar meow::BallProjection< Scalar >::radius ( Scalar const &  r)
inline

Setup the radius.

Parameters
[in]rNew value of the radius
Returns
New radius
template<class Scalar >
BallProjection& meow::BallProjection< Scalar >::referenceFrom ( BallProjection< Scalar > const &  b)
inline

Reference settings from another one.

Parameters
[in]bAnother one
Returns
*this
template<class Scalar >
Matrix<Scalar> meow::BallProjection< Scalar >::transformate ( Matrix< Scalar > const &  x) const
inlinevirtual

Project the input vector(s) onto the hyper-sphere and return it.

If the number of columns of the input matrix is larger than 1, this method will think that you want to transform multiple vector once and the number of columns of the output matrix will be the same of the number of columns of the input one.

Parameters
[in]xThe input matrix.
Returns
The output matrix.
Note
Take into account that too much safty checking will lead to inefficient, this method will not checking whether the dimension of the input vector/matrix is right. So be sure the data is valid before you call this method.

Implements meow::Transformation< Scalar >.


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