ML 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< DT, size > ml::Tvec10< MLdouble > ml::Tvec2< MLdouble > 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.
 

Public Member Functions

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

Related Symbols

(Note that these are not member symbols.)

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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
template<class T , size_t size, class DataContainer >
bool operator! (const FloatingPointVector< T, size, DataContainer > &a)
 Returns whether all components are 0.
 
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.
 
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.
 
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...
 
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.
 
template<class T , size_t size, class DataContainer >
operator* (const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b)
 Dot product, returns a.dot(b).
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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].
 
template<class T , size_t size, class DataContainer >
compMul (const FloatingPointVector< T, size, DataContainer > &vec)
 Returns the product of all components.
 

Additional Inherited Members

- Protected Attributes inherited from ml::FloatingPointVectorDataContainerBase< DT, size >
DT _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 586 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 953 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 912 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 899 of file mlFloatingPointVector.h.

References ml::compMin().

Referenced by ml::FloatingPointVector< T, size, DataContainer >::clamp(), 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 889 of file mlFloatingPointVector.h.

References ml::compMax().

Referenced by ml::FloatingPointVector< T, size, DataContainer >::clamp(), 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 844 of file mlFloatingPointVector.h.

References MLAbs().

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 944 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 854 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 935 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 833 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 ( ) const
inline

Returns the maximum of absolute component values.

Definition at line 809 of file mlFloatingPointVector.h.

References MLAbs().

◆ 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 822 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 ( ) const
inline

Returns the product of all vector components.

Definition at line 798 of file mlFloatingPointVector.h.

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 926 of file mlFloatingPointVector.h.

◆ 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 863 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 873 of file mlFloatingPointVector.h.

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

◆ compSum()

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

Returns the sum of all components.

Definition at line 787 of file mlFloatingPointVector.h.

◆ 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 220 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 741 of file mlFloatingPointVector.h.

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

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 ( ) const
inline

Returns the number of elements of value buffer.

Definition at line 696 of file mlFloatingPointVector.h.

◆ length()

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

Returns the length of the vector, i.e. norm2().

Definition at line 769 of file mlFloatingPointVector.h.

Referenced by ml::TQuaternion< DT >::cos(), ml::TQuaternion< DT >::cosh(), ml::TQuaternion< DT >::sin(), and ml::TQuaternion< DT >::sinh().

◆ lengthSquared()

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

Returns the squared length of the vector.

Definition at line 778 of file mlFloatingPointVector.h.

◆ norm2() [1/2]

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

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

Definition at line 706 of file mlFloatingPointVector.h.

◆ 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 722 of file mlFloatingPointVector.h.

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

◆ 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 753 of file mlFloatingPointVector.h.

References MLValueIs0WOM().

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

◆ 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 624 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 645 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 595 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 609 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 677 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 666 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 973 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 963 of file mlFloatingPointVector.h.

Friends And Related Symbol 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 523 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 508 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 495 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 447 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 482 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 435 of file mlFloatingPointVector.h.

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

◆ 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 423 of file mlFloatingPointVector.h.

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

◆ 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 537 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 458 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 470 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 326 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 383 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 393 of file mlFloatingPointVector.h.

◆ 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 403 of file mlFloatingPointVector.h.

◆ 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 285 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 274 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 plus, for completeness and for those who really want to use that...

Definition at line 360 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 338 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 252 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 371 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 349 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 263 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 413 of file mlFloatingPointVector.h.

◆ 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 312 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 297 of file mlFloatingPointVector.h.


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