MeVisLab Toolbox Reference
ml::FloatingPointVector< T, size, DataContainer > Class Template Reference

Template class for vector arithmetic with floating point data types. More...

#include <mlFloatingPointVector.h>

Inheritance diagram for ml::FloatingPointVector< T, size, DataContainer >:
ml::FloatingPointVectorDataContainerBase< T, size > ml::Tvec10< MLdouble > ml::Tvec2< MLdouble > ml::Tvec2< MLfloat > ml::Tvec3< MLdouble > ml::Tvec4< MLdouble > ml::Tvec5< MLdouble > ml::Tvec6< MLdouble >

Public Types

enum  { Size = size }
 This enum grants access to the size during compile time, e.g. More...
 
typedef T ComponentType
 A typedef to "export" the type of components. More...
 

Public Member Functions

Constructors and assignment operators.
 FloatingPointVector (T value=T(0))
 Default and value constructor. More...
 
FloatingPointVector< T, size, DataContainer > & operator= (T value)
 Assignment of scalar value to all components. More...
 
Comparison.
bool operator== (const FloatingPointVector< T, size, DataContainer > &buffer) const
 Returns whether *this and buffer are component wise equal. More...
 
bool operator!= (const FloatingPointVector< T, size, DataContainer > &buffer) const
 Returns whether any components of *this and buffer are not equal. More...
 
bool operator< (const FloatingPointVector< T, size, DataContainer > &buffer) const
 Defines an artificial order for use in sort algorithms (lexicographical order). More...
 
Value access and indexing operators.
const Toperator[] (const size_t i) const
 Constant indexing operators. More...
 
Toperator[] (const size_t i)
 Indexing operators. More...
 
Other operations.
size_t getSize () const
 Returns the number of elements of value buffer. More...
 
T norm2 () const
 Returns the Euclidean norm (the vector length), i.e., square root of sum of squares of all components. More...
 
T norm2 (const FloatingPointVector< T, size, DataContainer > &weight) const
 Returns the weighted Euclidean norm, i.e., square root of sum of squares of all components multiplied with corresponding squared component of weight. More...
 
T dot (const FloatingPointVector< T, size, DataContainer > &buffer) const
 Returns the dot product, i.e., sum of all components multiplied with corresponding components of buffer. More...
 
T normalize ()
 Normalizes the buffer and returns the Euclidean length of vector before normalization, i.e., norm2. More...
 
T length () const
 Returns the length of the vector, i.e. norm2(). More...
 
T distance (const FloatingPointVector< T, size, DataContainer > &buffer) const
 Returns the distance of this vector to a given one. More...
 
T distanceSquared (const FloatingPointVector< T, size, DataContainer > &buffer) const
 Returns the squared distance of this vector to a given one. More...
 
T lengthSquared () const
 Returns the squared length of the vector. More...
 
T compSum () const
 Returns the sum of all components. More...
 
T compMul () const
 Returns the product of all vector components. More...
 
T compMaxAbs () const
 Returns the maximum of absolute component values. More...
 
void compMin (FloatingPointVector< T, size, DataContainer > buffer)
 Sets the component wise minimum of *this and buffer in *this. More...
 
void compMax (FloatingPointVector< T, size, DataContainer > buffer)
 Sets the component wise maximum of *this and buffer in *this. More...
 
void compAbs ()
 Kills negative signs from all components. More...
 
void compDiv (const FloatingPointVector< T, size, DataContainer > &d)
 Divides each vector component by the corresponding one of d. More...
 
void compSqr ()
 Calculates and sets the square of all components. More...
 
void compSqrt ()
 Calculates and sets square root of all components. More...
 
void clampMin (const FloatingPointVector< T, size, DataContainer > &lower)
 Calculates and sets all components clamped to lower, i.e., if any component is smaller than the corresponding one in lower then it is set to the one from lower. More...
 
void clampMax (const FloatingPointVector< T, size, DataContainer > &upper)
 Calculates and sets all components clamped to upper, i.e., if any component is greater than the corresponding one in upper then it is set to the one from upper. More...
 
void clamp (const FloatingPointVector< T, size, DataContainer > &lower, const FloatingPointVector< T, size, DataContainer > &upper)
 Calculates and sets all components of *this so that they are between minimum min and maximum max. More...
 
void compRound ()
 Rounds all components of this vector using floor(component + 0.5). More...
 
void compFloor ()
 Rounds all components of this vector using floor(component). More...
 
void compCeil ()
 Rounds all components of this vector to integer using ceil(component). More...
 
FloatingPointVector< T, 3, DataContainer > cross (const FloatingPointVector< T, 3, DataContainer > &b) const
 Returns the cross product for elements, i.e., return vector vertical to *this and b. More...
 
void apply (ML_LA_FROM_DOUBLE_TO_DOUBLE f)
 Applies the function f to each component starting from index 0 to index size-1. More...
 
std::ostream & writeOut (std::ostream &os) const
 Writes all components to ostream os starting from index 0 to size-1. More...
 
std::istream & readIn (std::istream &is)
 Reads all components from istream is starting starting from index 0 to size-1. More...
 

Related Functions

(Note that these are not member functions.)

Standalone functions for FloatingPointVector.
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator+= (FloatingPointVector< T, size, DataContainer > &op1, const FloatingPointVector< T, size, DataContainer > &buffer)
 Arithmetic assignment: Component wise addition. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator-= (FloatingPointVector< T, size, DataContainer > &op1, const FloatingPointVector< T, size, DataContainer > &buffer)
 Arithmetic assignment: Component wise subtraction of buffer from *this. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator*= (FloatingPointVector< T, size, DataContainer > &op1, MLdouble value)
 Arithmetic assignment: Component wise multiplication *this with specialized MLdouble scalar value. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator*= (FloatingPointVector< T, size, DataContainer > &op1, const FloatingPointVector< T, size, DataContainer > &op2)
 Arithmetic assignment: Component wise multiplication *this with a vector of the same size. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator/= (FloatingPointVector< T, size, DataContainer > &op1, MLdouble value)
 Arithmetic assignment: Component wise division of *this by scalar value. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator/= (FloatingPointVector< T, size, DataContainer > &op1, const FloatingPointVector< T, size, DataContainer > &op2)
 Arithmetic assignment: Component wise division of *this by the values of a vector of the same size. More...
 
template<class T , size_t size, class DataContainer >
bool operator! (const FloatingPointVector< T, size, DataContainer > &a)
 Returns whether all components are 0. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator+ (FloatingPointVector< T, size, DataContainer > lhs, const FloatingPointVector< T, size, DataContainer > &rhs)
 Return value is the component wise addition of lhs and rhs. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator- (FloatingPointVector< T, size, DataContainer > lhs, const FloatingPointVector< T, size, DataContainer > &rhs)
 Return value is the component wise subtraction of rhs from lhs. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator+ (const FloatingPointVector< T, size, DataContainer > &buffer)
 Unary plus, for completeness and for those who really want to use that... More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator- (const FloatingPointVector< T, size, DataContainer > &buffer)
 Unary minus, all components of the vector are multiplied with -1. More...
 
template<class T , size_t size, class DataContainer >
T operator* (const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b)
 Dot product, returns a.dot(b). More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator* (FloatingPointVector< T, size, DataContainer > lhs, MLdouble rhs)
 Component wise multiplication of lhs with rhs. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator* (MLdouble lhs, FloatingPointVector< T, size, DataContainer > rhs)
 Component wise multiplication of rhs with lhs. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator/ (FloatingPointVector< T, size, DataContainer > lhs, MLdouble rhs)
 Component wise division of lhs by specialized rhs of type MLdouble. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compMin (FloatingPointVector< T, size, DataContainer > buffer1, const FloatingPointVector< T, size, DataContainer > &buffer2)
 Component wise minimum of buffer1 and buffer2. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compMax (FloatingPointVector< T, size, DataContainer > buffer1, const FloatingPointVector< T, size, DataContainer > &buffer2)
 Component wise maximum of buffer1 and buffer2. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compAbs (FloatingPointVector< T, size, DataContainer > vec)
 Returns a vector with all components from vec without negative sign. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compSqr (FloatingPointVector< T, size, DataContainer > vec)
 Returns a vector with all components from vec squared. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compSqrt (FloatingPointVector< T, size, DataContainer > vec)
 Returns a vector with all components from vec square-rooted. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compDiv (FloatingPointVector< T, size, DataContainer > vec, const FloatingPointVector< T, size, DataContainer > &d)
 Component wise division of vec / d. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > clampMin (FloatingPointVector< T, size, DataContainer > vec, const FloatingPointVector< T, size, DataContainer > &m)
 Returns a new vector with all components from vec clamped to minimum m. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > clampMax (FloatingPointVector< T, size, DataContainer > vec, const FloatingPointVector< T, size, DataContainer > &m)
 Returns a new vector with all components from vec clamped to maximum m. More...
 
template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > clamp (FloatingPointVector< T, size, DataContainer > vec, const FloatingPointVector< T, size, DataContainer > &lower, const FloatingPointVector< T, size, DataContainer > &upper)
 Returns a new vector with all components from vec clamped to range [lower, upper]. More...
 
template<class T , size_t size, class DataContainer >
T compMul (const FloatingPointVector< T, size, DataContainer > &vec)
 Returns the product of all components. More...
 

Additional Inherited Members

- Protected Attributes inherited from ml::FloatingPointVectorDataContainerBase< T, size >
T _buffer [size]
 

Detailed Description

template<class T, size_t size, class DataContainer = FloatingPointVectorDataContainerBase<T, size>>
class ml::FloatingPointVector< T, size, DataContainer >

Template class for vector arithmetic with floating point data types.

Notes:

  • Class is intended for floating point data types.
  • Instantiation with integer types are not tested but legal, however some operations might be insecure or not precise, hence be careful with integer types.
  • No dynamic members exist; so default copy constructor and assignment operator can be used.
  • There is still some non optimal stuff inside...
  • Derived classes with double type are e.g. Vector2, Vector3, Vector4, Vector6, Vector8, Vector16, Vector32.

Definition at line 62 of file mlFloatingPointVector.h.

Member Typedef Documentation

◆ ComponentType

template<class T , size_t size, class DataContainer = FloatingPointVectorDataContainerBase<T, size>>
typedef T ml::FloatingPointVector< T, size, DataContainer >::ComponentType

A typedef to "export" the type of components.

Definition at line 68 of file mlFloatingPointVector.h.

Member Enumeration Documentation

◆ anonymous enum

template<class T , size_t size, class DataContainer = FloatingPointVectorDataContainerBase<T, size>>
anonymous enum

This enum grants access to the size during compile time, e.g.

it can be used as a template argument.

Enumerator
Size 

Definition at line 72 of file mlFloatingPointVector.h.

Constructor & Destructor Documentation

◆ FloatingPointVector()

template<class T , size_t size, class DataContainer >
ml::FloatingPointVector< T, size, DataContainer >::FloatingPointVector ( T  value = T(0))
inlineexplicit

Default and value constructor.

Default is the initialization of all components with value whose default is 0.

Definition at line 633 of file mlFloatingPointVector.h.

Member Function Documentation

◆ apply()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::apply ( ML_LA_FROM_DOUBLE_TO_DOUBLE  f)
inline

Applies the function f to each component starting from index 0 to index size-1.

Definition at line 1000 of file mlFloatingPointVector.h.

◆ clamp()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::clamp ( const FloatingPointVector< T, size, DataContainer > &  lower,
const FloatingPointVector< T, size, DataContainer > &  upper 
)
inline

Calculates and sets all components of *this so that they are between minimum min and maximum max.

This is done by applying clampMin(lower) first and then clampMax(upper). Note that components can become smaller than lower if a component in upper is smaller than their corresponding one in in lower.

Definition at line 959 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::clampMax(), and ml::FloatingPointVector< T, size, DataContainer >::clampMin().

◆ clampMax()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::clampMax ( const FloatingPointVector< T, size, DataContainer > &  upper)
inline

Calculates and sets all components clamped to upper, i.e., if any component is greater than the corresponding one in upper then it is set to the one from upper.

Definition at line 946 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compMin().

Referenced by ml::FloatingPointVector< T, size, DataContainer >::clamp(), and ml::FloatingPointVector< T, size, DataContainer >::clampMax().

◆ clampMin()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::clampMin ( const FloatingPointVector< T, size, DataContainer > &  lower)
inline

Calculates and sets all components clamped to lower, i.e., if any component is smaller than the corresponding one in lower then it is set to the one from lower.

Definition at line 936 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compMax().

Referenced by ml::FloatingPointVector< T, size, DataContainer >::clamp(), and ml::FloatingPointVector< T, size, DataContainer >::clampMin().

◆ compAbs()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compAbs
inline

Kills negative signs from all components.

Definition at line 891 of file mlFloatingPointVector.h.

References MLAbs(), and T.

Referenced by ml::FloatingPointVector< T, size, DataContainer >::compAbs().

◆ compCeil()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compCeil
inline

Rounds all components of this vector to integer using ceil(component).

Definition at line 991 of file mlFloatingPointVector.h.

◆ compDiv()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compDiv ( const FloatingPointVector< T, size, DataContainer > &  d)
inline

Divides each vector component by the corresponding one of d.

Divisions by zero are not handled; the caller must avoid them.

Definition at line 901 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer.

Referenced by ml::FloatingPointVector< T, size, DataContainer >::compDiv().

◆ compFloor()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compFloor
inline

Rounds all components of this vector using floor(component).

Definition at line 982 of file mlFloatingPointVector.h.

◆ compMax()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compMax ( FloatingPointVector< T, size, DataContainer >  buffer)
inline

Sets the component wise maximum of *this and buffer in *this.

Definition at line 880 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer.

Referenced by ml::FloatingPointVector< T, size, DataContainer >::compMax().

◆ compMaxAbs()

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::compMaxAbs
inline

Returns the maximum of absolute component values.

Definition at line 856 of file mlFloatingPointVector.h.

References MLAbs(), and T.

◆ compMin()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compMin ( FloatingPointVector< T, size, DataContainer >  buffer)
inline

Sets the component wise minimum of *this and buffer in *this.

Definition at line 869 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer.

Referenced by ml::FloatingPointVector< T, size, DataContainer >::compMin().

◆ compMul()

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::compMul
inline

Returns the product of all vector components.

Definition at line 845 of file mlFloatingPointVector.h.

References T.

Referenced by ml::FloatingPointVector< T, size, DataContainer >::compMul().

◆ compRound()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compRound
inline

Rounds all components of this vector using floor(component + 0.5).

Definition at line 973 of file mlFloatingPointVector.h.

References T.

◆ compSqr()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compSqr
inline

Calculates and sets the square of all components.

Definition at line 910 of file mlFloatingPointVector.h.

Referenced by ml::FloatingPointVector< T, size, DataContainer >::compSqr().

◆ compSqrt()

template<class T , size_t size, class DataContainer >
void ml::FloatingPointVector< T, size, DataContainer >::compSqrt
inline

Calculates and sets square root of all components.

Negative values have to be avoided by caller.

Definition at line 920 of file mlFloatingPointVector.h.

References T.

Referenced by ml::FloatingPointVector< T, size, DataContainer >::compSqrt().

◆ compSum()

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::compSum
inline

Returns the sum of all components.

Definition at line 834 of file mlFloatingPointVector.h.

References T.

◆ cross()

template<class T , size_t size, class DataContainer = FloatingPointVectorDataContainerBase<T, size>>
FloatingPointVector<T, 3, DataContainer> ml::FloatingPointVector< T, size, DataContainer >::cross ( const FloatingPointVector< T, 3, DataContainer > &  b) const
inline

Returns the cross product for elements, i.e., return vector vertical to *this and b.

Definition at line 267 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer.

Referenced by ml::TQuaternion< DT >::mult().

◆ distance()

template<class T , size_t size, class DataContainer = FloatingPointVectorDataContainerBase<T, size>>
T ml::FloatingPointVector< T, size, DataContainer >::distance ( const FloatingPointVector< T, size, DataContainer > &  buffer) const
inline

Returns the distance of this vector to a given one.

Definition at line 151 of file mlFloatingPointVector.h.

◆ distanceSquared()

template<class T , size_t size, class DataContainer = FloatingPointVectorDataContainerBase<T, size>>
T ml::FloatingPointVector< T, size, DataContainer >::distanceSquared ( const FloatingPointVector< T, size, DataContainer > &  buffer) const
inline

Returns the squared distance of this vector to a given one.

Definition at line 157 of file mlFloatingPointVector.h.

◆ dot()

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::dot ( const FloatingPointVector< T, size, DataContainer > &  buffer) const
inline

Returns the dot product, i.e., sum of all components multiplied with corresponding components of buffer.

Definition at line 788 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and T.

Referenced by ml::TQuaternion< DT >::mult(), and ml::FloatingPointVector< T, size, DataContainer >::operator*().

◆ getSize()

template<class T , size_t size, class DataContainer >
size_t ml::FloatingPointVector< T, size, DataContainer >::getSize
inline

Returns the number of elements of value buffer.

Definition at line 743 of file mlFloatingPointVector.h.

◆ length()

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::length
inline

◆ lengthSquared()

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::lengthSquared
inline

Returns the squared length of the vector.

Definition at line 825 of file mlFloatingPointVector.h.

◆ norm2() [1/2]

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::norm2
inline

Returns the Euclidean norm (the vector length), i.e., square root of sum of squares of all components.

Definition at line 753 of file mlFloatingPointVector.h.

References T.

◆ norm2() [2/2]

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::norm2 ( const FloatingPointVector< T, size, DataContainer > &  weight) const
inline

Returns the weighted Euclidean norm, i.e., square root of sum of squares of all components multiplied with corresponding squared component of weight.

Definition at line 769 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and T.

◆ normalize()

template<class T , size_t size, class DataContainer >
T ml::FloatingPointVector< T, size, DataContainer >::normalize
inline

Normalizes the buffer and returns the Euclidean length of vector before normalization, i.e., norm2.

On zero vector length the vector is left unchanged.

Definition at line 800 of file mlFloatingPointVector.h.

References MLValueIs0WOM(), and T.

Referenced by ml::Tmat4< DT >::getRotationMatrix().

◆ operator!=()

template<class T , size_t size, class DataContainer >
bool ml::FloatingPointVector< T, size, DataContainer >::operator!= ( const FloatingPointVector< T, size, DataContainer > &  buffer) const
inline

Returns whether any components of *this and buffer are not equal.

Definition at line 671 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and MLValuesDifferWOM().

◆ operator<()

template<class T , size_t size, class DataContainer >
bool ml::FloatingPointVector< T, size, DataContainer >::operator< ( const FloatingPointVector< T, size, DataContainer > &  buffer) const
inline

Defines an artificial order for use in sort algorithms (lexicographical order).

Starting from the first component(i.e. index 0) all components from *this are compared with the corresponding one in buffer: If the components of *this is smaller than the corresponding one in buffer then true is returned, if the comparison is bigger then false is returned and on equality the components for the next index are compared. If all components are equal then false is returned.

Definition at line 692 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and MLValuesDifferWOM().

◆ operator=()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & ml::FloatingPointVector< T, size, DataContainer >::operator= ( T  value)
inline

Assignment of scalar value to all components.

Definition at line 642 of file mlFloatingPointVector.h.

◆ operator==()

template<class T , size_t size, class DataContainer >
bool ml::FloatingPointVector< T, size, DataContainer >::operator== ( const FloatingPointVector< T, size, DataContainer > &  buffer) const
inline

Returns whether *this and buffer are component wise equal.

Definition at line 656 of file mlFloatingPointVector.h.

References ml::FloatingPointVectorDataContainerBase< DT, size >::_buffer, and MLValuesDifferWOM().

◆ operator[]() [1/2]

template<class T , size_t size, class DataContainer >
T & ml::FloatingPointVector< T, size, DataContainer >::operator[] ( const size_t  i)
inline

Indexing operators.

The caller must guarantee that is in [0, size-1]. It is legal to consider all elements as a subsequent array in memory for pointer addressing of all elements.

Definition at line 724 of file mlFloatingPointVector.h.

◆ operator[]() [2/2]

template<class T , size_t size, class DataContainer >
const T & ml::FloatingPointVector< T, size, DataContainer >::operator[] ( const size_t  i) const
inline

Constant indexing operators.

The caller must guarantee that is in [0, size-1]. It is legal to consider all elements as a subsequent array in memory for pointer addressing of all elements.

Definition at line 713 of file mlFloatingPointVector.h.

◆ readIn()

template<class T , size_t size, class DataContainer >
std::istream & ml::FloatingPointVector< T, size, DataContainer >::readIn ( std::istream &  is)
inline

Reads all components from istream is starting starting from index 0 to size-1.

Definition at line 1020 of file mlFloatingPointVector.h.

References ml::is().

◆ writeOut()

template<class T , size_t size, class DataContainer >
std::ostream & ml::FloatingPointVector< T, size, DataContainer >::writeOut ( std::ostream &  os) const
inline

Writes all components to ostream os starting from index 0 to size-1.

Each buffer elements is followed separated by a space symbols " ".

Definition at line 1010 of file mlFloatingPointVector.h.

Friends And Related Function Documentation

◆ clamp()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > clamp ( FloatingPointVector< T, size, DataContainer >  vec,
const FloatingPointVector< T, size, DataContainer > &  lower,
const FloatingPointVector< T, size, DataContainer > &  upper 
)
related

Returns a new vector with all components from vec clamped to range [lower, upper].

Not that this does not hold if components in lower are greater than their corresponding ones in upper. See FloatingPointVector<T, size, DataContainer>::clamp().

Definition at line 570 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::clampMax(), and ml::FloatingPointVector< T, size, DataContainer >::clampMin().

◆ clampMax()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > clampMax ( FloatingPointVector< T, size, DataContainer >  vec,
const FloatingPointVector< T, size, DataContainer > &  m 
)
related

Returns a new vector with all components from vec clamped to maximum m.

See FloatingPointVector<T, size, DataContainer>::clampMax().

Definition at line 555 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::clampMax().

◆ clampMin()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > clampMin ( FloatingPointVector< T, size, DataContainer >  vec,
const FloatingPointVector< T, size, DataContainer > &  m 
)
related

Returns a new vector with all components from vec clamped to minimum m.

See FloatingPointVector<T, size, DataContainer>::clampMin().

Definition at line 542 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::clampMin().

◆ compAbs()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compAbs ( FloatingPointVector< T, size, DataContainer >  vec)
related

Returns a vector with all components from vec without negative sign.

Definition at line 494 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compAbs().

◆ compDiv()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compDiv ( FloatingPointVector< T, size, DataContainer >  vec,
const FloatingPointVector< T, size, DataContainer > &  d 
)
related

Component wise division of vec / d.

Division by zeros are not handled and must be avoided by caller.

Definition at line 529 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compDiv().

◆ compMax()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compMax ( FloatingPointVector< T, size, DataContainer >  buffer1,
const FloatingPointVector< T, size, DataContainer > &  buffer2 
)
related

Component wise maximum of buffer1 and buffer2.

Definition at line 482 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compMax().

Referenced by ml::FloatingPointVector< T, size, DataContainer >::clampMin().

◆ compMin()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compMin ( FloatingPointVector< T, size, DataContainer >  buffer1,
const FloatingPointVector< T, size, DataContainer > &  buffer2 
)
related

Component wise minimum of buffer1 and buffer2.

Definition at line 470 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compMin().

Referenced by ml::FloatingPointVector< T, size, DataContainer >::clampMax().

◆ compMul()

template<class T , size_t size, class DataContainer >
T compMul ( const FloatingPointVector< T, size, DataContainer > &  vec)
related

Returns the product of all components.

Definition at line 584 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compMul().

◆ compSqr()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compSqr ( FloatingPointVector< T, size, DataContainer >  vec)
related

Returns a vector with all components from vec squared.

Definition at line 505 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compSqr().

◆ compSqrt()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > compSqrt ( FloatingPointVector< T, size, DataContainer >  vec)
related

Returns a vector with all components from vec square-rooted.

Definition at line 517 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::compSqrt().

◆ operator!()

template<class T , size_t size, class DataContainer >
bool operator! ( const FloatingPointVector< T, size, DataContainer > &  a)
related

Returns whether all components are 0.

Definition at line 373 of file mlFloatingPointVector.h.

◆ operator*() [1/3]

template<class T , size_t size, class DataContainer >
T operator* ( const FloatingPointVector< T, size, DataContainer > &  a,
const FloatingPointVector< T, size, DataContainer > &  b 
)
related

Dot product, returns a.dot(b).

Definition at line 430 of file mlFloatingPointVector.h.

References ml::FloatingPointVector< T, size, DataContainer >::dot().

◆ operator*() [2/3]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator* ( FloatingPointVector< T, size, DataContainer >  lhs,
MLdouble  rhs 
)
related

Component wise multiplication of lhs with rhs.

Definition at line 440 of file mlFloatingPointVector.h.

References T.

◆ operator*() [3/3]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator* ( MLdouble  lhs,
FloatingPointVector< T, size, DataContainer >  rhs 
)
related

Component wise multiplication of rhs with lhs.

Definition at line 450 of file mlFloatingPointVector.h.

References T.

◆ operator*=() [1/2]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator*= ( FloatingPointVector< T, size, DataContainer > &  op1,
const FloatingPointVector< T, size, DataContainer > &  op2 
)
related

Arithmetic assignment: Component wise multiplication *this with a vector of the same size.

Definition at line 332 of file mlFloatingPointVector.h.

◆ operator*=() [2/2]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator*= ( FloatingPointVector< T, size, DataContainer > &  op1,
MLdouble  value 
)
related

Arithmetic assignment: Component wise multiplication *this with specialized MLdouble scalar value.

Definition at line 321 of file mlFloatingPointVector.h.

References T.

◆ operator+() [1/2]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator+ ( const FloatingPointVector< T, size, DataContainer > &  buffer)
related

Unary plus, for completeness and for those who really want to use that...

Definition at line 407 of file mlFloatingPointVector.h.

◆ operator+() [2/2]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator+ ( FloatingPointVector< T, size, DataContainer >  lhs,
const FloatingPointVector< T, size, DataContainer > &  rhs 
)
related

Return value is the component wise addition of lhs and rhs.

Definition at line 385 of file mlFloatingPointVector.h.

◆ operator+=()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator+= ( FloatingPointVector< T, size, DataContainer > &  op1,
const FloatingPointVector< T, size, DataContainer > &  buffer 
)
related

Arithmetic assignment: Component wise addition.

Definition at line 299 of file mlFloatingPointVector.h.

◆ operator-() [1/2]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator- ( const FloatingPointVector< T, size, DataContainer > &  buffer)
related

Unary minus, all components of the vector are multiplied with -1.

Definition at line 418 of file mlFloatingPointVector.h.

◆ operator-() [2/2]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator- ( FloatingPointVector< T, size, DataContainer >  lhs,
const FloatingPointVector< T, size, DataContainer > &  rhs 
)
related

Return value is the component wise subtraction of rhs from lhs.

Definition at line 396 of file mlFloatingPointVector.h.

◆ operator-=()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator-= ( FloatingPointVector< T, size, DataContainer > &  op1,
const FloatingPointVector< T, size, DataContainer > &  buffer 
)
related

Arithmetic assignment: Component wise subtraction of buffer from *this.

Definition at line 310 of file mlFloatingPointVector.h.

◆ operator/()

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > operator/ ( FloatingPointVector< T, size, DataContainer >  lhs,
MLdouble  rhs 
)
related

Component wise division of lhs by specialized rhs of type MLdouble.

Definition at line 460 of file mlFloatingPointVector.h.

References T.

◆ operator/=() [1/2]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator/= ( FloatingPointVector< T, size, DataContainer > &  op1,
const FloatingPointVector< T, size, DataContainer > &  op2 
)
related

Arithmetic assignment: Component wise division of *this by the values of a vector of the same size.

Division by zero is not handled and must be avoided by user.

Definition at line 359 of file mlFloatingPointVector.h.

◆ operator/=() [2/2]

template<class T , size_t size, class DataContainer >
FloatingPointVector< T, size, DataContainer > & operator/= ( FloatingPointVector< T, size, DataContainer > &  op1,
MLdouble  value 
)
related

Arithmetic assignment: Component wise division of *this by scalar value.

Division by zero is not handled and must be avoided by user.

Definition at line 344 of file mlFloatingPointVector.h.

References T.


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