Rosetta
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
numeric::MathVector< T > Class Template Reference

#include <MathVector.hh>

Public Member Functions

 MathVector ()
 default constructor More...
 
 MathVector (const Size SIZE, const T &FILL_VALUE=T(0))
 construct from size and possible filler More...
 
 MathVector (const Size SIZE, const T *DATA)
 construct from length and pointer to data More...
 
 MathVector (MathVector const &VECTOR)
 copy constructor More...
 
MathVector< T > * clone () const
 Clone function. More...
 
 ~MathVector ()
 @ brief destructor More...
 
Size size () const
 size of vector More...
 
const T * begin () const
 pointer to First Element More...
 
T * begin ()
 pointer to First Element More...
 
const T * end () const
 pointer to end of range More...
 
T * end ()
 pointer to end of range More...
 
T norm () const
 norm = length of vector More...
 
T square_norm () const
 square norm = square length of vector More...
 
T sum () const
 sum up all elements More...
 
MathVector< T > MakeVector (const T &X)
 construct vector from one element More...
 
MathVector< T > MakeVector (const T &X, const T &Y)
 construct vector from two elements More...
 
MathVector< T > MakeVector (const T &X, const T &Y, const T &Z)
 construct vector from three elements More...
 
bool operator== (MathVector< T > const &rhs) const
 
T & operator() (const Size POS)
 return reference to changeable element ( POS) More...
 
const T & operator() (const Size POS) const
 return copy of element ( POS) More...
 
MathVector< T > & operator= (const MathVector< T > &VECTOR)
 equal operator More...
 
MathVector< T > & operator= (const T &VALUE)
 equal operator More...
 
MathVector< T > & operator+= (const T &VALUE)
 operator += VALUE More...
 
MathVector< T > & operator-= (const T &VALUE)
 operator -= VALUE More...
 
MathVector< T > & operator*= (const T &VALUE)
 operator *= VALUE More...
 
MathVector< T > & operator/= (const T &VALUE)
 operator /= VALUE More...
 
MathVector< T > & operator-= (const MathVector< T > &BASE)
 operator -= BASE More...
 
MathVector< T > & operator+= (const MathVector< T > &BASE)
 operator += BASE More...
 

Protected Member Functions

bool assert_valid_position (const Size POS) const
 check whether position is valid More...
 

Private Attributes

Size size_
 length of vector More...
 
T * data_
 range of dynamically allocated memory of size size_ More...
 

Constructor & Destructor Documentation

◆ MathVector() [1/4]

template<typename T >
numeric::MathVector< T >::MathVector ( )
inline

default constructor

◆ MathVector() [2/4]

template<typename T >
numeric::MathVector< T >::MathVector ( const Size  SIZE,
const T &  FILL_VALUE = T( 0) 
)
inlineexplicit

construct from size and possible filler

Parameters
SIZEnumber fo elements in Vector
FILL_VALUEassign every element to that value

◆ MathVector() [3/4]

template<typename T >
numeric::MathVector< T >::MathVector ( const Size  SIZE,
const T *  DATA 
)
inline

construct from length and pointer to data

◆ MathVector() [4/4]

template<typename T >
numeric::MathVector< T >::MathVector ( MathVector< T > const &  VECTOR)
inline

copy constructor

Parameters
VECTORcopy the given Vector

References erraser_util::copy(), numeric::MathVector< T >::data_, and numeric::MathVector< T >::size_.

◆ ~MathVector()

template<typename T >
numeric::MathVector< T >::~MathVector ( )
inline

@ brief destructor

Member Function Documentation

◆ assert_valid_position()

template<typename T >
bool numeric::MathVector< T >::assert_valid_position ( const Size  POS) const
inlineprotected

check whether position is valid

References numeric::MathVector< T >::size_, and utility_exit_with_message.

Referenced by numeric::MathVector< T >::operator()().

◆ begin() [1/2]

template<typename T >
T* numeric::MathVector< T >::begin ( )
inline

pointer to First Element

Returns
pointer to first element in range containing all elements of Vector

References numeric::MathVector< T >::data_.

◆ begin() [2/2]

template<typename T >
const T* numeric::MathVector< T >::begin ( ) const
inline

◆ clone()

template<typename T >
MathVector< T>* numeric::MathVector< T >::clone ( ) const
inline

Clone function.

Returns
pointer to new Vector< T>

◆ end() [1/2]

template<typename T >
T* numeric::MathVector< T >::end ( )
inline

pointer to end of range

Returns
pointer to address one after last element in Vector

References numeric::MathVector< T >::data_, and numeric::MathVector< T >::size_.

◆ end() [2/2]

template<typename T >
const T* numeric::MathVector< T >::end ( ) const
inline

◆ MakeVector() [1/3]

template<typename T >
MathVector< T> numeric::MathVector< T >::MakeVector ( const T &  X)
inline

construct vector from one element

◆ MakeVector() [2/3]

template<typename T >
MathVector< T> numeric::MathVector< T >::MakeVector ( const T &  X,
const T &  Y 
)
inline

construct vector from two elements

References spectral_cluster_kmeans_adaptive_kernel_density_bb_dependent_rotlib::Y.

◆ MakeVector() [3/3]

template<typename T >
MathVector< T> numeric::MathVector< T >::MakeVector ( const T &  X,
const T &  Y,
const T &  Z 
)
inline

construct vector from three elements

References spectral_cluster_kmeans_adaptive_kernel_density_bb_dependent_rotlib::Y.

◆ norm()

template<typename T >
T numeric::MathVector< T >::norm ( ) const
inline

norm = length of vector

Returns
length of vector

References numeric::MathVector< T >::square_norm(), and pyrosetta.distributed.cluster.exceptions::T.

◆ operator()() [1/2]

template<typename T >
T& numeric::MathVector< T >::operator() ( const Size  POS)
inline

return reference to changeable element ( POS)

References numeric::MathVector< T >::assert_valid_position(), and numeric::MathVector< T >::data_.

◆ operator()() [2/2]

template<typename T >
const T& numeric::MathVector< T >::operator() ( const Size  POS) const
inline

◆ operator*=()

template<typename T >
MathVector< T>& numeric::MathVector< T >::operator*= ( const T &  VALUE)
inline

◆ operator+=() [1/2]

template<typename T >
MathVector< T>& numeric::MathVector< T >::operator+= ( const MathVector< T > &  BASE)
inline

◆ operator+=() [2/2]

template<typename T >
MathVector<T>& numeric::MathVector< T >::operator+= ( const T &  VALUE)
inline

◆ operator-=() [1/2]

template<typename T >
MathVector< T>& numeric::MathVector< T >::operator-= ( const MathVector< T > &  BASE)
inline

◆ operator-=() [2/2]

template<typename T >
MathVector< T>& numeric::MathVector< T >::operator-= ( const T &  VALUE)
inline

◆ operator/=()

template<typename T >
MathVector< T>& numeric::MathVector< T >::operator/= ( const T &  VALUE)
inline

◆ operator=() [1/2]

template<typename T >
MathVector< T>& numeric::MathVector< T >::operator= ( const MathVector< T > &  VECTOR)
inline

equal operator

Parameters
VECTORsource vector
Returns
reference to this assigned Vector

References erraser_util::copy(), numeric::MathVector< T >::data_, and numeric::MathVector< T >::size_.

◆ operator=() [2/2]

template<typename T >
MathVector< T>& numeric::MathVector< T >::operator= ( const T &  VALUE)
inline

equal operator

Parameters
VALUEall elements are set to that value
Returns
reference to this assigned Vector

References numeric::MathVector< T >::data_, detail::fill(), and numeric::MathVector< T >::size_.

◆ operator==()

template<typename T >
bool numeric::MathVector< T >::operator== ( MathVector< T > const &  rhs) const
inline

◆ size()

template<typename T >
Size numeric::MathVector< T >::size ( ) const
inline

◆ square_norm()

template<typename T >
T numeric::MathVector< T >::square_norm ( ) const
inline

square norm = square length of vector

Returns
square length of vector

References numeric::MathVector< T >::begin(), numeric::MathVector< T >::end(), numeric::inner_product(), and pyrosetta.distributed.cluster.exceptions::T.

Referenced by numeric::MathVector< T >::norm().

◆ sum()

template<typename T >
T numeric::MathVector< T >::sum ( ) const
inline

Member Data Documentation

◆ data_

template<typename T >
T* numeric::MathVector< T >::data_
private

◆ size_

template<typename T >
Size numeric::MathVector< T >::size_
private

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