Simple Application Framework  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Types
Saf::Math::Algebra::Vector< N, T > Class Template Reference

Class representing vector object from linear algebra. More...

#include <Vector.h>

Inheritance diagram for Saf::Math::Algebra::Vector< N, T >:
Saf::Collection::StaticArray< N, T >

List of all members.

Public Member Functions

 Vector ()
 Default constructor.
 Vector (const T &v)
 Constructor.
 Vector (const T &v1, const T &v2)
 Constructor useful for 2D vectors.
 Vector (const T &v1, const T &v2, const T &v3)
 Constructor useful for 3D vectors.
 Vector (const T &v1, const T &v2, const T &v3, const T &v4)
 Constructor useful for 4D vectors.
 Vector (const MyType &v)
 Copy constructor.
Angle (const MyType &v) const
 Angle between two vectors in Euclidean space.
Angle (const MyType &v, const Matrix< N, N, T > &m) const
 Angle between two vectors in specific metric tensor space.
template<Size CN, class CT >
Vector< CN, CT > Convert (CT padVal=0) const
 Convert vector to another data type or another dimension.
DotProduct (const MyType &v) const
 Compute Euclidean dot product.
MyTypeFill (const T &val)
 Assign val to all vector elements.
Gcd () const
 Greatest common divisor of vector elements.
template<Size M>
InnerProduct (const Matrix< N, M, T > &m, const MyType &v) const
 Compute inner product using given matrix.
Lcm () const
 Least common multiple of vector elements.
Length () const
 Euclidean length of the vector.
Length (const Matrix< N, N, T > &m) const
 Length of the vector in specific metric tensor space.
template<Size M>
Vector< M, T > Mul (const Matrix< N, M, T > &m) const
 Vector by matrix multiplication operator.
MyTypeNormalize ()
 Normalize the vector.
MyType Normalized () const
 Get normalized version of the vector.
MyType operator* (const MyType &v) const
 Pointwise vector multiplication.
MyType operator* (const T &v) const
 Vector multiplication by scalar.
MyTypeoperator*= (const MyType &v)
 Pointwise vector multiplication operator.
MyTypeoperator*= (const T &v)
 Multiplication by scalar value.
MyType operator+ (const MyType &v) const
 Vector addition operator.
MyTypeoperator+= (const MyType &v)
 Vector addition operator.
MyType operator- (const MyType &v) const
 Vector substraction operator.
MyType operator- () const
 Unary minus operator.
MyTypeoperator-= (const MyType &v)
 Vector substraction operator.
MyType operator/ (const MyType &v) const
 Pointwise vector division.
MyType operator/ (const T &v) const
 Vector division by scalar.
MyTypeoperator/= (const MyType &v)
 Pointwise vector division operator.
MyTypeoperator/= (const T &v)
 Vector division by scalar.
bool operator< (const MyType &v) const
 Lexicographical comparison.
bool operator<= (const MyType &v) const
 Lexicographical comparison.
MyTypeoperator= (const MyType &v)
 Assignment operator.
bool operator> (const MyType &v) const
 Lexicographical comparison.
bool operator>= (const MyType &v) const
 Lexicographical comparison.
template<Size M>
Matrix< N, M, T > OuterProduct (const Vector< M, T > &v)
 Outer vector product.
Product () const
 Get the product of vector elements.
Int8 Sgn () const
 Vector sign.
Sum () const
 Get sum of vector elements.
Matrix< N, 1, T > ToColumnMatrix () const
 Convert column vector to a matrix.
Matrix< 1, N, T > ToRowMatrix () const
 Convert row vector to a matrix.

Protected Types

typedef
Collection::StaticArray< N, T > 
BaseType
typedef Vector< N, T > MyType

Detailed Description

template<Size N, class T>
class Saf::Math::Algebra::Vector< N, T >

Class representing vector object from linear algebra.

Template Parameters:
NDimensionality of the space.
TData type.

Member Typedef Documentation

template<Size N, class T>
typedef Collection::StaticArray<N,T> Saf::Math::Algebra::Vector< N, T >::BaseType [protected]
template<Size N, class T>
typedef Vector<N,T> Saf::Math::Algebra::Vector< N, T >::MyType [protected]

Constructor & Destructor Documentation

template<Size N, class T>
Saf::Math::Algebra::Vector< N, T >::Vector ( ) [inline]

Default constructor.

No initialization of the elements is done.

template<Size N, class T>
Saf::Math::Algebra::Vector< N, T >::Vector ( const T &  v) [inline, explicit]

Constructor.

Initializes all elements with given value.

template<Size N, class T>
Saf::Math::Algebra::Vector< N, T >::Vector ( const T &  v1,
const T &  v2 
) [inline]

Constructor useful for 2D vectors.

template<Size N, class T>
Saf::Math::Algebra::Vector< N, T >::Vector ( const T &  v1,
const T &  v2,
const T &  v3 
) [inline]

Constructor useful for 3D vectors.

template<Size N, class T>
Saf::Math::Algebra::Vector< N, T >::Vector ( const T &  v1,
const T &  v2,
const T &  v3,
const T &  v4 
) [inline]

Constructor useful for 4D vectors.

template<Size N, class T>
Saf::Math::Algebra::Vector< N, T >::Vector ( const MyType v) [inline]

Copy constructor.


Member Function Documentation

template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::Angle ( const MyType v) const [inline]

Angle between two vectors in Euclidean space.

Returns:
Angle in radians.
template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::Angle ( const MyType v,
const Matrix< N, N, T > &  m 
) const [inline]

Angle between two vectors in specific metric tensor space.

Parameters:
[in]vA vector.
[in]mMetric tensor. Positive definite symmetric bilinear form.
Returns:
Angle in radians.
template<Size N, class T>
template<Size CN, class CT >
Vector<CN,CT> Saf::Math::Algebra::Vector< N, T >::Convert ( CT  padVal = 0) const [inline]

Convert vector to another data type or another dimension.

If CN < N, then the vector is truncated, otherwise it is padded with padVal.

template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::DotProduct ( const MyType v) const [inline]

Compute Euclidean dot product.

template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::Fill ( const T &  val) [inline]

Assign val to all vector elements.

template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::Gcd ( ) const [inline]

Greatest common divisor of vector elements.

template<Size N, class T>
template<Size M>
T Saf::Math::Algebra::Vector< N, T >::InnerProduct ( const Matrix< N, M, T > &  m,
const MyType v 
) const [inline]

Compute inner product using given matrix.

template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::Lcm ( ) const [inline]

Least common multiple of vector elements.

template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::Length ( ) const [inline]

Euclidean length of the vector.

template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::Length ( const Matrix< N, N, T > &  m) const [inline]

Length of the vector in specific metric tensor space.

This method computes $ \sqrt{v^T \cdot m \cdot v} $.

Parameters:
[in]mMetric tensor. Positive definite symmetric bilinear form.
template<Size N, class T>
template<Size M>
Vector<M,T> Saf::Math::Algebra::Vector< N, T >::Mul ( const Matrix< N, M, T > &  m) const [inline]

Vector by matrix multiplication operator.

template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::Normalize ( ) [inline]

Normalize the vector.

template<Size N, class T>
MyType Saf::Math::Algebra::Vector< N, T >::Normalized ( ) const [inline]

Get normalized version of the vector.

template<Size N, class T>
MyType Saf::Math::Algebra::Vector< N, T >::operator* ( const MyType v) const [inline]

Pointwise vector multiplication.

template<Size N, class T>
MyType Saf::Math::Algebra::Vector< N, T >::operator* ( const T &  v) const [inline]

Vector multiplication by scalar.

template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::operator*= ( const MyType v) [inline]

Pointwise vector multiplication operator.

template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::operator*= ( const T &  v) [inline]

Multiplication by scalar value.

template<Size N, class T>
MyType Saf::Math::Algebra::Vector< N, T >::operator+ ( const MyType v) const [inline]

Vector addition operator.

template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::operator+= ( const MyType v) [inline]

Vector addition operator.

template<Size N, class T>
MyType Saf::Math::Algebra::Vector< N, T >::operator- ( const MyType v) const [inline]

Vector substraction operator.

template<Size N, class T>
MyType Saf::Math::Algebra::Vector< N, T >::operator- ( ) const [inline]

Unary minus operator.

template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::operator-= ( const MyType v) [inline]

Vector substraction operator.

template<Size N, class T>
MyType Saf::Math::Algebra::Vector< N, T >::operator/ ( const MyType v) const [inline]

Pointwise vector division.

template<Size N, class T>
MyType Saf::Math::Algebra::Vector< N, T >::operator/ ( const T &  v) const [inline]

Vector division by scalar.

template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::operator/= ( const MyType v) [inline]

Pointwise vector division operator.

template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::operator/= ( const T &  v) [inline]

Vector division by scalar.

template<Size N, class T>
bool Saf::Math::Algebra::Vector< N, T >::operator< ( const MyType v) const [inline]

Lexicographical comparison.

Remarks:
Most significant element is the last one.
template<Size N, class T>
bool Saf::Math::Algebra::Vector< N, T >::operator<= ( const MyType v) const [inline]

Lexicographical comparison.

Remarks:
Most significant element is the last one.
template<Size N, class T>
MyType& Saf::Math::Algebra::Vector< N, T >::operator= ( const MyType v) [inline]

Assignment operator.

Reimplemented from Saf::Collection::StaticArray< N, T >.

template<Size N, class T>
bool Saf::Math::Algebra::Vector< N, T >::operator> ( const MyType v) const [inline]

Lexicographical comparison.

template<Size N, class T>
bool Saf::Math::Algebra::Vector< N, T >::operator>= ( const MyType v) const [inline]

Lexicographical comparison.

template<Size N, class T>
template<Size M>
Matrix<N,M,T> Saf::Math::Algebra::Vector< N, T >::OuterProduct ( const Vector< M, T > &  v) [inline]

Outer vector product.

template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::Product ( ) const [inline]

Get the product of vector elements.

template<Size N, class T>
Int8 Saf::Math::Algebra::Vector< N, T >::Sgn ( ) const [inline]

Vector sign.

Returns:
-1 for vectors that are less than zero vector, 1 for vectors greater than zero vector and 0 for zero vector.
Remarks:
Most significant element is the last one.
template<Size N, class T>
T Saf::Math::Algebra::Vector< N, T >::Sum ( ) const [inline]

Get sum of vector elements.

template<Size N, class T>
Matrix<N,1,T> Saf::Math::Algebra::Vector< N, T >::ToColumnMatrix ( ) const [inline]

Convert column vector to a matrix.

template<Size N, class T>
Matrix<1,N,T> Saf::Math::Algebra::Vector< N, T >::ToRowMatrix ( ) const [inline]

Convert row vector to a matrix.


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