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

vector More...

#include "Vector.h"

Public Member Functions

 Vector ()
 constructor More...
 
 Vector (Vector const &v)
 constructor More...
 
 Vector (Matrix< Scalar > const &m)
 constructor More...
 
 Vector (Matrix< Scalar > const &m, size_t i)
 constructor More...
 
 Vector (std::vector< Scalar > const &v)
 constructor More...
 
 Vector (size_t d, Scalar const &e)
 constructor More...
 
 ~Vector ()
 destructor More...
 
VectorcopyFrom (Vector const &v)
 copy from ... More...
 
VectorreferenceFrom (Vector const &v)
 reference from ... More...
 
Matrix< Scalar > const & matrix () const
 Return a dimension x 1 matrix form of it. More...
 
size_t dimension () const
 return dimension More...
 
size_t dimension (size_t d, Scalar const &s)
 resize the dimension More...
 
bool valid () const
 Return whether dimension>0 is true or not. More...
 
Scalar entry (size_t i) const
 return i -th entry More...
 
Scalar entry (size_t i, Scalar const &s)
 change i -th entry More...
 
void entries (size_t i, size_t j, Scalar const &s)
 change i -th to j -th entries More...
 
Vector subVector (size_t i, size_t j)
 subvector form i-th to j-th More...
 
Vector positive () const
 return +(*this) More...
 
Vector negative () const
 return -(*this) More...
 
Vector add (Vector const &v) const
 return (*this)+v More...
 
Vector sub (Vector const &v) const
 return (*this)-v More...
 
Vector mul (Scalar const &s) const
 return (*this)*s , where s is a scalar More...
 
Vector div (Scalar const &s) const
 return (*this)/s , where s is a scalar More...
 
Scalar dot (Vector const &v) const
 dot More...
 
Scalar length () const
 sqrt of length2 More...
 
Scalar length2 () const
 same as (*this).dot(*this) More...
 
Vector normalize () const
 return a normalize form of itself More...
 
Vectornormalized ()
 Let itself be normalize form. More...
 
Vectoroperator= (Vector const &v)
 same as copyFrom More...
 
Scalar operator() (size_t i) const
 same as entry(i) More...
 
Vector operator+ () const
 same as positive() More...
 
Vector operator- () const
 same as negative() More...
 
Vector operator+ (Vector const &v) const
 same as add(v) More...
 
Vector operator- (Vector const &v) const
 same as sub(v) More...
 
Scalar operator* (Vector const &v) const
 same as dot(v) More...
 
Vector operator* (Scalar const &s) const
 same as mul(s) More...
 
Vector operator/ (Scalar const &s) const
 same as div(s) More...
 

Detailed Description

template<class Scalar>
class meow::Vector< Scalar >

vector

Author
cat_leopard

Constructor & Destructor Documentation

template<class Scalar>
meow::Vector< Scalar >::Vector ( )
inline

constructor

With dimension=0, which means invalid.

template<class Scalar>
meow::Vector< Scalar >::Vector ( Vector< Scalar > const &  v)
inline

constructor

Copy from another vector

Parameters
[in]vanother vector
template<class Scalar>
meow::Vector< Scalar >::Vector ( Matrix< Scalar > const &  m)
inline

constructor

From matrix's first column

Parameters
[in]mmatrix
template<class Scalar>
meow::Vector< Scalar >::Vector ( Matrix< Scalar > const &  m,
size_t  i 
)
inline

constructor

From matrix's i-th column

Parameters
[in]mmatrix
[in]ii-th
template<class Scalar>
meow::Vector< Scalar >::Vector ( std::vector< Scalar > const &  v)
inline

constructor

Copy from another std::vector

Parameters
[in]vvector
template<class Scalar>
meow::Vector< Scalar >::Vector ( size_t  d,
Scalar const &  e 
)
inline

constructor

setup dimension and inital value

Parameters
[in]ddimension
[in]einital value
template<class Scalar>
meow::Vector< Scalar >::~Vector ( )
inline

destructor

Member Function Documentation

template<class Scalar>
Vector meow::Vector< Scalar >::add ( Vector< Scalar > const &  v) const
inline

return (*this)+v

template<class Scalar>
Vector& meow::Vector< Scalar >::copyFrom ( Vector< Scalar > const &  v)
inline

copy from ...

template<class Scalar>
size_t meow::Vector< Scalar >::dimension ( ) const
inline

return dimension

template<class Scalar>
size_t meow::Vector< Scalar >::dimension ( size_t  d,
Scalar const &  s 
)
inline

resize the dimension

Parameters
[in]dnew dimension
[in]sinital entry
Returns
new dimension
template<class Scalar>
Vector meow::Vector< Scalar >::div ( Scalar const &  s) const
inline

return (*this)/s , where s is a scalar

template<class Scalar>
Scalar meow::Vector< Scalar >::dot ( Vector< Scalar > const &  v) const
inline

dot

template<class Scalar>
void meow::Vector< Scalar >::entries ( size_t  i,
size_t  j,
Scalar const &  s 
)
inline

change i -th to j -th entries

Parameters
[in]ii-th
[in]jj-th
[in]snew value
template<class Scalar>
Scalar meow::Vector< Scalar >::entry ( size_t  i) const
inline

return i -th entry

template<class Scalar>
Scalar meow::Vector< Scalar >::entry ( size_t  i,
Scalar const &  s 
)
inline

change i -th entry

Parameters
[in]ii-th
[in]snew value
template<class Scalar>
Scalar meow::Vector< Scalar >::length ( ) const
inline

sqrt of length2

template<class Scalar>
Scalar meow::Vector< Scalar >::length2 ( ) const
inline

same as (*this).dot(*this)

template<class Scalar>
Matrix<Scalar> const& meow::Vector< Scalar >::matrix ( ) const
inline

Return a dimension x 1 matrix form of it.

template<class Scalar>
Vector meow::Vector< Scalar >::mul ( Scalar const &  s) const
inline

return (*this)*s , where s is a scalar

template<class Scalar>
Vector meow::Vector< Scalar >::negative ( ) const
inline

return -(*this)

template<class Scalar>
Vector meow::Vector< Scalar >::normalize ( ) const
inline

return a normalize form of itself

template<class Scalar>
Vector& meow::Vector< Scalar >::normalized ( )
inline

Let itself be normalize form.

template<class Scalar>
Scalar meow::Vector< Scalar >::operator() ( size_t  i) const
inline

same as entry(i)

template<class Scalar>
Scalar meow::Vector< Scalar >::operator* ( Vector< Scalar > const &  v) const
inline

same as dot(v)

template<class Scalar>
Vector meow::Vector< Scalar >::operator* ( Scalar const &  s) const
inline

same as mul(s)

template<class Scalar>
Vector meow::Vector< Scalar >::operator+ ( ) const
inline

same as positive()

template<class Scalar>
Vector meow::Vector< Scalar >::operator+ ( Vector< Scalar > const &  v) const
inline

same as add(v)

template<class Scalar>
Vector meow::Vector< Scalar >::operator- ( ) const
inline

same as negative()

template<class Scalar>
Vector meow::Vector< Scalar >::operator- ( Vector< Scalar > const &  v) const
inline

same as sub(v)

template<class Scalar>
Vector meow::Vector< Scalar >::operator/ ( Scalar const &  s) const
inline

same as div(s)

template<class Scalar>
Vector& meow::Vector< Scalar >::operator= ( Vector< Scalar > const &  v)
inline

same as copyFrom

template<class Scalar>
Vector meow::Vector< Scalar >::positive ( ) const
inline

return +(*this)

template<class Scalar>
Vector& meow::Vector< Scalar >::referenceFrom ( Vector< Scalar > const &  v)
inline

reference from ...

template<class Scalar>
Vector meow::Vector< Scalar >::sub ( Vector< Scalar > const &  v) const
inline

return (*this)-v

template<class Scalar>
Vector meow::Vector< Scalar >::subVector ( size_t  i,
size_t  j 
)
inline

subvector form i-th to j-th

template<class Scalar>
bool meow::Vector< Scalar >::valid ( ) const
inline

Return whether dimension>0 is true or not.

Returns
true/false

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