Base class for all higher level values like tensors, vectors, matrices and so on. More...
#include <WValue.h>
Public Member Functions | |
WValue (size_t nbComponents) | |
Create a WValue with the given number of components. | |
WValue (const WValue &newValue) | |
Create a WValue as copy of the one given as parameter. | |
template<typename S > | |
WValue (const WValue< S > &newValue) | |
Create a WValue as copy of the one given as parameter but with another template type. | |
WValue (const WVector_2 &newValues) | |
Create a WValue from the given WVector_2. | |
size_t | size () const |
Get number of components the value consists of. | |
T & | operator[] (size_t i) |
Returns a reference to the i-th component in order to provide access to the component. | |
const T & | operator[] (size_t i) const |
Returns a CONST reference to the i-th component in order to provide read-only access to the component. | |
bool | operator== (const WValue &rhs) const |
Compares two WValues and returns true if they contain the same data. | |
bool | operator!= (const WValue &rhs) const |
Compares two WValues and returns true if they contain the different data. | |
WValue & | operator= (const WValue &rhs) |
Assigns the contents of its argument to the contents of this WValue. | |
WValue & | operator+= (const WValue &rhs) |
Adds a the argument component-wise to the components of this WValue. | |
WValue & | operator-= (const WValue &rhs) |
Subtracts the argument component-wise from the components of this WValue. | |
WValue & | operator*= (double rhs) |
Scales each component of this WValue with the given scalar argument. | |
WValue & | operator*= (const WValue &rhs) |
Scales each component of this WValue with the corresponding component of the given argument WValue. | |
WValue & | operator/= (const double rhs) |
Scales each component of this WValue with the given scalar argument. | |
const WValue | operator+ (const WValue &summand2) const |
Component-wise addition. | |
const WValue | operator- (const WValue &subtrahend) const |
Component-wise subtraction. | |
const WValue | operator* (const WValue &factor2) const |
Component-wise multiplication. | |
double | norm () const |
Square root of sum of squares of elements. | |
double | normSquare () const |
Sum of squares of elements. | |
void | normalize () |
Make the norm of this WValue be 1 by dividing by WValue::norm(). | |
WValue | normalized () const |
Return a normalized version of the current WValue without modifying it. | |
T | mean () const |
Returns the mean value of all values stored in this WValue. | |
T | median () const |
Returns the median of all values stored in this WValue. | |
void | resize (size_t size) |
Changes the number of scalars held by this WValue. | |
WVector_2 | toWVector () |
Returns this WValue as WVector_2. | |
Private Attributes | |
std::vector< T > | m_components |
The components the value is composed of. | |
Friends | |
class | WValue |
All WValues are friends of each other. |
Base class for all higher level values like tensors, vectors, matrices and so on.
Definition at line 39 of file WValue.h.
T WValue< T >::mean | ( | ) | const [inline] |
Returns the mean value of all values stored in this WValue.
Definition at line 324 of file WValue.h.
Referenced by WValueTest::testMean(), and WValueTest::testMedian().
T WValue< T >::median | ( | ) | const [inline] |
double WValue< T >::norm | ( | ) | const [inline] |
Square root of sum of squares of elements.
This function returns double instead of T because norm includes a square root and thus its computation automatically results in a floating point number.
Definition at line 270 of file WValue.h.
Referenced by WValue< double >::normalize(), WValueTest::testNormalize(), WValueTest::testNormalized(), WValueTest::testNormDouble(), and WValueTest::testNormInt().
void WValue< T >::normalize | ( | ) | [inline] |
Make the norm of this WValue be 1 by dividing by WValue::norm().
Definition at line 299 of file WValue.h.
Referenced by WValue< double >::normalized(), and WValueTest::testNormalize().
Return a normalized version of the current WValue without modifying it.
Definition at line 313 of file WValue.h.
Referenced by WValueTest::testNormalized().
double WValue< T >::normSquare | ( | ) | const [inline] |
Sum of squares of elements.
This function returns double instead of T because normSquare includes many squares and thus might return large values that might not fit into T's range of values. Double prevents an overflow. Additionally this is consistent with norm().
Definition at line 284 of file WValue.h.
Referenced by WValue< double >::norm(), WValue< double >::normSquare(), and WValueTest::testNormSquare().
const WValue WValue< T >::operator* | ( | const WValue< T > & | factor2 | ) | const [inline] |
Component-wise multiplication.
factor2 | The right hand side of the product |
Reimplemented in WMatrix< T >.
T& WValue< T >::operator[] | ( | size_t | i | ) | [inline] |
const T& WValue< T >::operator[] | ( | size_t | i | ) | const [inline] |
void WValue< T >::resize | ( | size_t | size | ) | [inline] |
size_t WValue< T >::size | ( | ) | const [inline] |
Get number of components the value consists of.
Definition at line 98 of file WValue.h.
Referenced by WSymmetricSphericalHarmonic::applyFunkRadonTransformation(), WSymmetricSphericalHarmonic::calcGFA(), WSymmetricSphericalHarmonic::getCoefficientsComplex(), WSymmetricSphericalHarmonic::getCoefficientsSchultz(), WMatrix< T >::getNbRows(), WMatrix< T >::makeIdentity(), WSymmetricSphericalHarmonic::normalize(), WMatrix< T >::operator WMatrix4d(), WMatrix< T >::operator()(), WMatrix< T >::operator*(), WMatrix< double >::setZero(), WTensorTypesTest::testCastTensorToVector(), WValueTest::testSize(), and WSymmetricSphericalHarmonic::WSymmetricSphericalHarmonic().
WVector_2 WValue< T >::toWVector | ( | ) | [inline] |
friend class WValue [friend] |
std::vector< T > WValue< T >::m_components [private] |
The components the value is composed of.
This contains the actual data
Definition at line 375 of file WValue.h.
Referenced by WValue< double >::mean(), WValue< double >::median(), WValue< double >::normalize(), WValue< double >::normSquare(), WValue< double >::operator!=(), WValue< double >::operator*(), WValue< double >::operator*=(), WValue< double >::operator+(), WValue< double >::operator+=(), WValue< double >::operator-(), WValue< double >::operator-=(), WValue< double >::operator/=(), WValue< double >::operator=(), WValue< double >::operator==(), WValue< double >::operator[](), WValue< double >::resize(), WValue< double >::size(), WValue< double >::toWVector(), and WValue< double >::WValue().