![]() |
OpenWalnut
1.5.0dev
|
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. More... | |
WValue (const WValue &newValue) | |
Create a WValue as copy of the one given as parameter. More... | |
template<typename S > | |
WValue (const WValue< S > &newValue) | |
Create a WValue as copy of the one given as parameter but with another template type. More... | |
WValue (const Eigen::VectorXd &newValues) | |
Create a WValue from the given Eigen::VectorXd. More... | |
WValue (const Eigen::VectorXf &newValues) | |
Create a WValue from the given Eigen::VectorXf. More... | |
WValue (const Eigen::VectorXi &newValues) | |
Create a WValue from the given Eigen::VectorXi. More... | |
size_t | size () const |
Get number of components the value consists of. More... | |
T & | operator[] (size_t i) |
Returns a reference to the i-th component in order to provide access to the component. More... | |
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. More... | |
bool | operator== (const WValue &rhs) const |
Compares two WValues and returns true if they contain the same data. More... | |
bool | operator!= (const WValue &rhs) const |
Compares two WValues and returns true if they contain the different data. More... | |
WValue & | operator= (const WValue &rhs) |
Assigns the contents of its argument to the contents of this WValue. More... | |
WValue & | operator+= (const WValue &rhs) |
Adds a the argument component-wise to the components of this WValue. More... | |
WValue & | operator-= (const WValue &rhs) |
Subtracts the argument component-wise from the components of this WValue. More... | |
WValue & | operator*= (double rhs) |
Scales each component of this WValue with the given scalar argument. More... | |
WValue & | operator*= (const WValue &rhs) |
Scales each component of this WValue with the corresponding component of the given argument WValue. More... | |
WValue & | operator/= (const double rhs) |
Scales each component of this WValue with the given scalar argument. More... | |
const WValue | operator+ (const WValue &summand2) const |
Component-wise addition. More... | |
const WValue | operator- (const WValue &subtrahend) const |
Component-wise subtraction. More... | |
const WValue | operator* (const WValue &factor2) const |
Component-wise multiplication. More... | |
double | norm () const |
Square root of sum of squares of elements. More... | |
double | normSquare () const |
Sum of squares of elements. More... | |
void | normalize () |
Make the norm of this WValue be 1 by dividing by WValue::norm() More... | |
WValue | normalized () const |
Return a normalized version of the current WValue without modifying it. More... | |
T | mean () const |
Returns the mean value of all values stored in this WValue. More... | |
T | median () const |
Returns the median of all values stored in this WValue. More... | |
void | resize (size_t size) |
Changes the number of scalars held by this WValue. More... | |
Private Member Functions | |
template<typename EigenDataType > | |
void | copyFromEigenVector (const Eigen::Matrix< EigenDataType, Eigen::Dynamic, 1 > &newValues) |
This function is used by the constructors that have the different Eigen::MatrixX types as parameter. More... | |
Private Attributes | |
std::vector< T > | m_components |
The components the value is composed of. More... | |
Friends | |
template<typename S > | |
class | WValue |
All WValues are friends of each other. More... | |
Base class for all higher level values like tensors, vectors, matrices and so on.
|
inlineexplicit |
Create a WValue as copy of the one given as parameter but with another template type.
newValue | The WValue to be copied. |
Definition at line 73 of file WValue.h.
References WValue< T >::m_components.
Create a WValue from the given Eigen::VectorXd.
newValues | The Eigen::VectorXd with the values. |
Definition at line 86 of file WValue.h.
References WValue< T >::copyFromEigenVector().
Create a WValue from the given Eigen::VectorXf.
newValues | The Eigen::VectorXf with the values. |
Definition at line 96 of file WValue.h.
References WValue< T >::copyFromEigenVector().
Create a WValue from the given Eigen::VectorXi.
newValues | The Eigen::VectorXi with the values. |
Definition at line 106 of file WValue.h.
References WValue< T >::copyFromEigenVector().
|
inlineprivate |
This function is used by the constructors that have the different Eigen::MatrixX types as parameter.
EigenDataType | The data type which is used by the Eigen::VectorX. |
newValues | The source Eigen::VectorX. |
Definition at line 382 of file WValue.h.
References WValue< T >::m_components.
Referenced by WValue< T >::WValue().
|
inline |
Returns the mean value of all values stored in this WValue.
Definition at line 342 of file WValue.h.
References WValue< T >::m_components.
Referenced by WValueTest::testMean(), and WValueTest::testMedian().
|
inline |
Returns the median of all values stored in this WValue.
Definition at line 357 of file WValue.h.
References WValue< T >::m_components.
|
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 288 of file WValue.h.
References WValue< T >::normSquare().
Referenced by WValue< T >::normalize(), WValueTest::testNormalize(), WValueTest::testNormalized(), WValueTest::testNormDouble(), and WValueTest::testNormInt().
|
inline |
Make the norm of this WValue be 1 by dividing by WValue::norm()
Definition at line 317 of file WValue.h.
References WValue< T >::m_components, and WValue< T >::norm().
Referenced by WValue< T >::normalized(), and WValueTest::testNormalize().
Return a normalized version of the current WValue without modifying it.
Definition at line 331 of file WValue.h.
References WValue< T >::normalize().
Referenced by WValueTest::testNormalized().
|
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 302 of file WValue.h.
References WValue< T >::m_components.
Referenced by WValue< T >::norm(), and WValueTest::testNormSquare().
Compares two WValues and returns true if they contain the different data.
rhs | The right hand side of the comparison |
Definition at line 160 of file WValue.h.
References WValue< T >::m_components.
Referenced by WMatrix< T >::operator!=().
|
inline |
Component-wise multiplication.
factor2 | The right hand side of the product |
Definition at line 272 of file WValue.h.
References WValue< T >::m_components.
Scales each component of this WValue with the corresponding component of the given argument WValue.
rhs | The right hand side of the assignment |
Definition at line 220 of file WValue.h.
References WValue< T >::m_components.
Scales each component of this WValue with the given scalar argument.
rhs | The right hand side of the assignment |
Definition at line 207 of file WValue.h.
References WValue< T >::m_components.
|
inline |
Component-wise addition.
summand2 | The right hand side of the summation |
Definition at line 246 of file WValue.h.
References WValue< T >::m_components.
Adds a the argument component-wise to the components of this WValue.
rhs | The right hand side of the assignment |
Definition at line 181 of file WValue.h.
References WValue< T >::m_components.
|
inline |
Component-wise subtraction.
subtrahend | The right hand side of the subtraction |
Definition at line 259 of file WValue.h.
References WValue< T >::m_components.
Subtracts the argument component-wise from the components of this WValue.
rhs | The right hand side of the assignment |
Definition at line 194 of file WValue.h.
References WValue< T >::m_components.
Scales each component of this WValue with the given scalar argument.
rhs | The right hand side of the assignment |
Definition at line 233 of file WValue.h.
References WValue< T >::m_components.
Assigns the contents of its argument to the contents of this WValue.
rhs | The right hand side of the assignment |
Definition at line 170 of file WValue.h.
References WValue< T >::m_components.
Referenced by WMatrix< T >::operator=().
Compares two WValues and returns true if they contain the same data.
rhs | The right hand side of the comparison |
Definition at line 150 of file WValue.h.
References WValue< T >::m_components.
Referenced by WMatrix< T >::operator==().
|
inline |
Returns a reference to the i-th component in order to provide access to the component.
i | element id |
Definition at line 127 of file WValue.h.
References WValue< T >::m_components.
|
inline |
Returns a CONST reference to the i-th component in order to provide read-only access to the component.
i | element id |
Definition at line 139 of file WValue.h.
References WValue< T >::m_components.
|
inline |
Changes the number of scalars held by this WValue.
size | The number of scalars stored in the WValue. |
Definition at line 369 of file WValue.h.
References WValue< T >::m_components, and WValue< T >::size().
|
inline |
Get number of components the value consists of.
Definition at line 116 of file WValue.h.
References WValue< T >::m_components.
Referenced by WSymmetricSphericalHarmonic< T >::calcMatrixWithEigenvalues(), WSymmetricSphericalHarmonic< T >::calcSmoothingMatrix(), WMTeemGlyphs::GlyphGeneration::operator()(), WMatrix< T >::operator*(), WValue< T >::resize(), WMatrix< T >::setZero(), WTensorTypesTest::testCastTensorToVector(), WLinearAlgebraFunctionsTest::testComputeSVD(), WValueTest::testSize(), and WMatrixFixed< ValueT, Rows, Cols, ValueStoreT >::WMatrixFixed().
|
private |
The components the value is composed of.
This contains the actual data
Definition at line 393 of file WValue.h.
Referenced by WValue< T >::copyFromEigenVector(), WValue< T >::mean(), WValue< T >::median(), WValue< T >::normalize(), WValue< T >::normSquare(), WValue< T >::operator!=(), WValue< T >::operator*(), WValue< T >::operator*=(), WValue< T >::operator+(), WValue< T >::operator+=(), WValue< T >::operator-(), WValue< T >::operator-=(), WValue< T >::operator/=(), WValue< T >::operator=(), WValue< T >::operator==(), WValue< T >::operator[](), WValue< T >::resize(), WValue< T >::size(), and WValue< T >::WValue().