Prototypes | Header File(s) | |
RWMathVec<double> |
abs(const RWMathVec<double>&) |
<rw/math/mathvec.h> |
RWMathVec<float> |
abs(const RWMathVec<float>&) |
<rw/math/mathvec.h> |
RWMathVec<int> |
abs(const RWMathVec<int>&) |
<rw/math/mathvec.h> |
RWMathVec<double> |
abs(const RWMathVec<DComplex>&) |
<rw/math/mathvec.h> |
RWMathVec<SChar> |
abs(const RWMathVec<SChar>&) |
<rw/math/mathvec.h> |
RWGenMat<double> |
abs(const RWGenMat<double>&) |
<rw/math/genmat.h> |
RWGenMat<float> |
abs(const RWGenMat<float>&) |
<rw/math/genmat.h> |
RWGenMat<int> |
abs(const RWGenMat<int>&) |
<rw/math/genmat.h> |
RWGenMat<double> |
abs(const RWGenMat<DComplex>&) |
<rw/math/genmat.h> <rw/math/genmat.h> |
RWGenMat<SChar> |
abs(const RWGenMat<SChar>&) |
<rw/math/genmat.h> |
RWMathArray<double> |
abs(const RWMathArray<double>&) |
<rw/math/mtharray.h> |
RWMathArray<float> |
abs(const RWMathArray<float>&) |
<rw/math/mtharray.h> |
RWMathArray<int> |
abs(const RWMathArray<int>&) |
<rw/math/mtharray.h> |
RWMathArray<double> |
abs(const RWMathArray<DComplex>&) |
<rw/math/mtharray.h> <rw/math/mtharray.h> |
RWMathArray<SChar> |
abs(const RWMathArray<SChar>&) |
<rw/math/mtharray.h> |
Returns the absolute values of each element. Note that the absolute value of a complex number is of type double. Therefore, if abs() is invoked for class RWMathVec<DComplex>, a vector of class RWMathVec<double> is returned.
>#include <rw/math/mathvec.h> #include <rw/rstream.h> const double adata[] = {1.2,2.4,-1.2,0.8,-4.5}; main() { RWMathVec<double> a(adata,5); RWMathVec<double> b = abs(a); cout << b; }
Program Output:
[ 1.2 2.4 1.2 0.8 4.5 ]