Templates -- Meow  204.13.18
A C++ template contains kinds of interesting classes and functions
meow::Vector< Scalar > Class Template Reference

vector More...

#include "Vector.h"

Public Types

typedef Matrix< Scalar >::EntryRefK ScalarRefK
 
typedef Matrix< Scalar >::EntryRef ScalarRef
 

Public Member Functions

 Vector ()
 constructor More...
 
 Vector (Vector const &v)
 constructor More...
 
 Vector (Matrix< Scalar > const &m)
 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 > 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 scalar (size_t i) const
 return i -th scalar More...
 
Scalar scalar (size_t i, Scalar const &s)
 change i -th scalar More...
 
ScalarRef scalarGet (size_t i)
 return i -th scalar with non-constant type More...
 
void scalars (size_t i, size_t j, Scalar const &s)
 change i -th to j -th scalars 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

Definition at line 19 of file Vector.h.

Member Typedef Documentation

template<class Scalar>
typedef Matrix<Scalar>::EntryRef meow::Vector< Scalar >::ScalarRef

Definition at line 22 of file Vector.h.

template<class Scalar>
typedef Matrix<Scalar>::EntryRefK meow::Vector< Scalar >::ScalarRefK

Definition at line 21 of file Vector.h.

Constructor & Destructor Documentation

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

constructor

With dimension=0, which means invalid.

Definition at line 31 of file Vector.h.

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

constructor

Copy from another vector

Parameters
[in]vanother vector

Definition at line 41 of file Vector.h.

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

constructor

From matrix's first column

Parameters
[in]mmatrix

Definition at line 51 of file Vector.h.

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

constructor

Copy from another std::vector

Parameters
[in]vvector

Definition at line 61 of file Vector.h.

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

Definition at line 75 of file Vector.h.

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

destructor

Definition at line 79 of file Vector.h.

Member Function Documentation

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

return (*this)+v

Definition at line 174 of file Vector.h.

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

copy from ...

Definition at line 83 of file Vector.h.

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

return dimension

Definition at line 100 of file Vector.h.

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

Definition at line 111 of file Vector.h.

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

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

Definition at line 189 of file Vector.h.

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

dot

Definition at line 194 of file Vector.h.

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

sqrt of length2

Definition at line 199 of file Vector.h.

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

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

Definition at line 204 of file Vector.h.

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

Return a dimension x 1 matrix form of it.

Definition at line 95 of file Vector.h.

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

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

Definition at line 184 of file Vector.h.

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

return -(*this)

Definition at line 169 of file Vector.h.

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

return a normalize form of itself

Definition at line 209 of file Vector.h.

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

Let itself be normalize form.

Definition at line 214 of file Vector.h.

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

same as entry(i)

Definition at line 225 of file Vector.h.

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

same as dot(v)

Definition at line 250 of file Vector.h.

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

same as mul(s)

Definition at line 255 of file Vector.h.

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

same as positive()

Definition at line 230 of file Vector.h.

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

same as add(v)

Definition at line 240 of file Vector.h.

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

same as negative()

Definition at line 235 of file Vector.h.

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

same as sub(v)

Definition at line 245 of file Vector.h.

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

same as div(s)

Definition at line 260 of file Vector.h.

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

same as copyFrom

Definition at line 220 of file Vector.h.

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

return +(*this)

Definition at line 164 of file Vector.h.

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

reference from ...

Definition at line 89 of file Vector.h.

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

return i -th scalar

Definition at line 125 of file Vector.h.

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

change i -th scalar

Parameters
[in]ii-th
[in]snew value

Definition at line 135 of file Vector.h.

template<class Scalar>
ScalarRef meow::Vector< Scalar >::scalarGet ( size_t  i)
inline

return i -th scalar with non-constant type

Definition at line 141 of file Vector.h.

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

change i -th to j -th scalars

Parameters
[in]ii-th
[in]jj-th
[in]snew value

Definition at line 152 of file Vector.h.

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

return (*this)-v

Definition at line 179 of file Vector.h.

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

subvector form i-th to j-th

Definition at line 159 of file Vector.h.

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

Return whether dimension>0 is true or not.

Returns
true/false

Definition at line 120 of file Vector.h.


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