SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
A templatized vector class. More...
#include <rw/math/mathvec.h>
Public Types | |
typedef RWMathVecIterator< T > | iterator |
typedef RWMathVecConstIterator< T > | const_iterator |
typedef rw_numeric_traits< T > ::promote_type | promote_type |
typedef rw_numeric_traits< T > ::norm_type | norm_type |
typedef rw_numeric_traits< T > ::mathFunType | mathFunType |
typedef rw_numeric_traits< T > ::mathFunType2 | mathFunType2 |
Public Member Functions | |
RWMathVec (size_t n, RWRandInterface &r) | |
RWMathVec () | |
RWMathVec (const RWMathVec< T > &a) | |
RWMathVec (size_t n, RWUninitialized) | |
RWMathVec (size_t n, const T &initval) | |
RWMathVec (size_t n, const T &initval, const T &incr) | |
RWMathVec (const char *s) | |
RWMathVec (const RWMathVecPick< T > &p) | |
RWMathVec (const T *dat, size_t n) | |
RWMathVec (const RWMathVec< double > &re, const RWMathVec< double > &im) | |
RWMathVec< T > | apply (typename rw_numeric_traits< T >::mathFunType f) const |
RWMathVec< norm_type > | apply2 (mathFunType2 f) const |
iterator | begin () |
const_iterator | begin () const |
size_t | binaryStoreSize () const |
RWMathVec< T > | copy () const |
T * | data () |
const T * | data () const |
RWMathVec< T > | deepCopy () const |
void | deepenShallowCopy () |
iterator | end () |
const_iterator | end () const |
size_t | length () const |
RWMathVecPick< T > | pick (const RWIntVec &v) |
RWMathVec< T > & | reference (const RWMathVec< T > &v) |
void | resize (size_t n) |
void | reshape (size_t n) |
void | restoreFrom (RWFile &) |
void | restoreFrom (RWvistream &) |
void | saveOn (RWFile &) const |
void | saveOn (RWvostream &) const |
RWMathVec< T > | slice (int start, size_t n, int stride=1) const |
int | stride () const |
T & | operator[] (int i) |
T | operator[] (int i) const |
T & | operator() (int i) |
T | operator() (int i) const |
RWMathVec< T > | operator[] (const RWSlice &) |
const RWMathVec< T > | operator[] (const RWSlice &) const |
RWMathVec< T > | operator() (const RWSlice &) |
const RWMathVec< T > | operator() (const RWSlice &) const |
RWMathVec< T > & | operator= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator= (const RWMathVecPick< T > &v) |
RWMathVec< T > & | operator= (const T &v) |
RWMathVec< T > & | operator+= (const T &v) |
RWMathVec< T > & | operator-= (const T &v) |
RWMathVec< T > & | operator*= (const T &v) |
RWMathVec< T > & | operator/= (const T &v) |
RWMathVec< T > & | operator+= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator-= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator*= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator/= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator++ () |
bool | operator== (const RWMathVec< T > &) const |
bool | operator!= (const RWMathVec< T > &v) const |
RWMathVec< T > & | operator-- () |
void | operator++ (int) |
void | operator-- (int) |
operator RWMathVec< promote_type > () | |
Friends | |
RWMathVec< double > | real (const RWMathVec< DComplex > &v) |
RWMathVec< double > | imag (const RWMathVec< DComplex > &v) |
Related Functions | |
(Note that these are not member functions.) | |
double | kurtosis (const RWMathVec< double > &) |
RWMathVec< double > | sort (const RWMathVec< double > &) |
double | skewness (const RWMathVec< double > &) |
template<class T > | |
RWMathVec< T > | operator- (const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator+ (const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator+ (const RWMathVec< T > &u, const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator- (const RWMathVec< T > &u, const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator* (const RWMathVec< T > &u, const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator/ (const RWMathVec< T > &u, const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator+ (const RWMathVec< T > &u, const T &s) |
template<class T > | |
RWMathVec< T > | operator- (const T &s, const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator* (const RWMathVec< T > &u, const T &s) |
template<class T > | |
RWMathVec< T > | operator/ (const T &s, const RWMathVec< T > &v) |
template<class T > | |
std::ostream & | operator<< (std::ostream &s, const RWMathVec< T > &v) |
template<class T > | |
std::istream & | operator>> (std::istream &s, RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator* (const T &s, const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator+ (const T &s, const RWMathVec< T > &v) |
template<class T > | |
RWMathVec< T > | operator- (const RWMathVec< T > &u, const T &s) |
template<class T > | |
RWMathVec< T > | operator/ (const RWMathVec< T > &u, const T &s) |
RWMathVec< double > | abs (const RWMathVec< double > &) |
RWMathVec< float > | abs (const RWMathVec< float > &) |
RWMathVec< int > | abs (const RWMathVec< int > &) |
RWMathVec< double > | abs (const RWMathVec< DComplex > &) |
RWMathVec< SChar > | abs (const RWMathVec< SChar > &) |
RWMathVec< float > | toFloat (const RWMathVec< double > &v) |
RWMathVec< int > | toInt (const RWMathVec< double > &v) |
RWMathVec< int > | toInt (const RWMathVec< float > &v) |
RWMathVec< SChar > | toChar (const RWMathVec< int > &v) |
template<class T > | |
RWMathVec< T > | cumsum (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | delta (const RWMathVec< T > &x) |
template<class T > | |
T | dot (const RWMathVec< T > &x, const RWMathVec< T > &y) |
template<class T > | |
int | maxIndex (const RWMathVec< T > &) |
template<class T > | |
T | maxValue (const RWMathVec< T > &) |
template<class T > | |
int | minIndex (const RWMathVec< T > &) |
template<class T > | |
T | minValue (const RWMathVec< T > &) |
template<class T > | |
T | prod (const RWMathVec< T > &) |
template<class T > | |
RWGenMat< T > | outerProduct (const RWMathVec< T > &x, const RWMathVec< T > &y) |
template<class T > | |
RWMathVec< T > | reverse (const RWMathVec< T > &) |
template<class T > | |
T | sum (const RWMathVec< T > &) |
template<class T > | |
RWMathVec< T > | cos (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | cosh (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | exp (const RWMathVec< T > &x) |
template<class T > | |
T | mean (const RWMathVec< T > &V) |
template<class T > | |
RWMathVec< T > | pow (const RWMathVec< T > &x, const RWMathVec< T > &y) |
template<class T > | |
RWMathVec< T > | pow (const RWMathVec< T > &x, T y) |
template<class T > | |
RWMathVec< T > | pow (T x, const RWMathVec< T > &y) |
template<class T > | |
RWMathVec< T > | sin (const RWMathVec< T > &V) |
template<class T > | |
RWMathVec< T > | sinh (const RWMathVec< T > &V) |
template<class T > | |
RWMathVec< T > | sqrt (const RWMathVec< T > &V) |
double | variance (const RWMathVec< double > &) |
double | variance (const RWMathVec< DComplex > &) |
float | variance (const RWMathVec< float > &) |
RWMathVec< double > | arg (const RWMathVec< DComplex > &v) |
RWMathVec< DComplex > | conj (const RWMathVec< DComplex > &x) |
DComplex | conjDot (const RWMathVec< DComplex > &x, const RWMathVec< DComplex > &y) |
RWMathVec< DComplex > | expandConjugateEven (const RWMathVec< DComplex > &) |
RWMathVec< DComplex > | expandConjugateOdd (const RWMathVec< DComplex > &) |
RWMathVec< DComplex > | rootsOfOne (int N, size_t nterms) |
Returns a complex vector v containing the complex Nth roots of unity. | |
RWMathVec< DComplex > | rootsOfOne (int N) |
Returns a complex vector v containing the complex Nth roots of unity. | |
double | spectralVariance (const RWMathVec< DComplex > &) |
template<class T > | |
RWMathVec< T > | acos (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | asin (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | atan (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | atan2 (const RWMathVec< T > &x, const RWMathVec< T > &y) |
template<class T > | |
RWMathVec< T > | ceil (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | expandEven (const RWMathVec< T > &) |
template<class T > | |
RWMathVec< T > | expandOdd (const RWMathVec< T > &) |
template<class T > | |
RWMathVec< T > | floor (const RWMathVec< T > &V) |
template<class T > | |
RWMathVec< T > | log (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | log10 (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | tan (const RWMathVec< T > &V) |
template<class T > | |
RWMathVec< T > | tanh (const RWMathVec< T > &V) |
RWMathVec< double > | norm (const RWMathVec< DComplex > &x) |
double | l2Norm (const RWMathVec< double > &v) |
float | l2Norm (const RWMathVec< float > &v) |
double | l2Norm (const RWMathVec< DComplex > &v) |
double | l1Norm (const RWMathVec< double > &v) |
float | l1Norm (const RWMathVec< float > &v) |
double | l1Norm (const RWMathVec< DComplex > &v) |
double | linfNorm (const RWMathVec< double > &v) |
float | linfNorm (const RWMathVec< float > &v) |
double | linfNorm (const RWMathVec< DComplex > &v) |
double | maxNorm (const RWMathVec< double > &v) |
float | maxNorm (const RWMathVec< float > &v) |
double | maxNorm (const RWMathVec< DComplex > &v) |
double | frobNorm (const RWMathVec< double > &v) |
float | frobNorm (const RWMathVec< float > &v) |
double | frobNorm (const RWMathVec< DComplex > &v) |
Class RWMathVec<T> is a templatized vector class.
#include <rw/math/mathvec.h> RWMathVec<T> vector;
#include <rw/math/mathvec.h> int main() { RWMathVec<int> v(5, rwUninitialized); v = 3; // Set all elements in v to 3 RWMathVec<int> w = v + 1; RWMathVec<int> y = v + w; }
typedef RWMathVecConstIterator<T> RWMathVec< T >::const_iterator |
Typedef for a random access const
iterator.
typedef RWMathVecIterator<T> RWMathVec< T >::iterator |
Typedef for a random access iterator.
typedef rw_numeric_traits<T>::mathFunType RWMathVec< T >::mathFunType |
Typedef for the function pointer used in the method apply(). For more information, see rw_numeric_traits<T>::mathFunType.
typedef rw_numeric_traits<T>::mathFunType2 RWMathVec< T >::mathFunType2 |
Typedef for the function pointer used in the method apply2(). For more information, see rw_numeric_traits<T>::mathFunType2.
typedef rw_numeric_traits<T>::norm_type RWMathVec< T >::norm_type |
Typedef for the usual return type of numerical norm
-like functions. For more information, see rw_numeric_traits<T>::norm_type.
typedef rw_numeric_traits<T>::promote_type RWMathVec< T >::promote_type |
Typedef for the promotion type. For more information, see rw_numeric_traits<T>::promote_type.
RWMathVec< T >::RWMathVec | ( | size_t | n, | |
RWRandInterface & | r | |||
) |
Constructs a vector with n elements initialized with random numbers generated by r.
Copy constructor. The new vector and the old vector both view the same data.
RWMathVec< T >::RWMathVec | ( | size_t | n, | |
RWUninitialized | ||||
) | [inline] |
Constructs a vector with n elements. The RWUninitialized type is an enumeration type with only one value, rwUninitialized. The rwUninitialized argument is used to distinguish the last dimension size from an initial value.
Constructs a vector with n elements, initialized to initval.
Constructs a vector with n elements. The first has value initval; each succeeding element is incremented by incr.
Constructs a matrix from the null terminated character string s. The format of the character string is the same as that expected by the global operator operator>>() described in this entry.
RWMathVec< T >::RWMathVec | ( | const RWMathVecPick< T > & | p | ) |
Constructs a new vector from an RWMathVecPick<T> . A copy of p's data is made.
Constructs a vector with n elements, using the data in the vector dat as initial data. A copy of dat is made. The vector dat must have at least n elements.
RWMathVec< T >::RWMathVec | ( | const RWMathVec< double > & | re, | |
const RWMathVec< double > & | im | |||
) |
A complex vec
is constructed from the double precision arrays re and im, with the real part of the vec
equal to re and the imaginary part equal to im. A new copy of the data is made.
RWMathVec<T> RWMathVec< T >::apply | ( | typename rw_numeric_traits< T >::mathFunType | f | ) | const [inline] |
Returns the result of applying the passed function to every element in the vector. A function of type RWMathVec<T>::mathFunType takes and returns a T
; a function of type RWMathVec<T>::mathFunType2 takes a T
and returns an RWMathVec<T>::norm_type.
RWMathVec<norm_type> RWMathVec< T >::apply2 | ( | mathFunType2 | f | ) | const |
Returns the result of applying the passed function to every element in the vector. A function of type RWMathVec<T>::mathFunType takes and returns a T
; a function of type RWMathVec<T>::mathFunType2 takes a T
and returns an RWMathVec<T>::norm_type.
const_iterator RWMathVec< T >::begin | ( | ) | const [inline] |
Returns an iterator that points to the first element in the vector.
Returns an iterator that points to the first element in the vector.
size_t RWMathVec< T >::binaryStoreSize | ( | ) | const |
Returns the number of bytes required to store the vector to an RWFile using member function saveOn(RWFile&).
Reimplemented in Histogram.
Returns a copy with distinct instance variables. The function copy() is a synonym for deepCopy().
const T* RWMathVec< T >::data | ( | void | ) | const [inline] |
Returns a pointer to the start of a vector's data. Should be used with care, as this accesses the vector's data directly. You are responsible for recognizing the length and the stride of the vector.
T* RWMathVec< T >::data | ( | void | ) | [inline] |
Returns a pointer to the start of a vector's data. Should be used with care, as this accesses the vector's data directly. You are responsible for recognizing the length and the stride of the vector.
Returns a copy with distinct instance variables. The function copy() is a synonym for deepCopy().
void RWMathVec< T >::deepenShallowCopy | ( | ) |
When invoked for a vector, guarantees that there is only one reference to that object and that its data are in contiguous storage.
const_iterator RWMathVec< T >::end | ( | ) | const [inline] |
Returns an iterator that points to one element past the last element in the vector.
Returns an iterator that points to one element past the last element in the vector.
size_t RWMathVec< T >::length | ( | ) | const [inline] |
Returns the number of elements in the vector.
Reimplemented from RWVecView.
RWMathVec< T >::operator RWMathVec< promote_type > | ( | ) | [inline] |
Implicit conversion operator to RWMathVec<promote_type> . The promote_type
is rw_numeric_traits<T>::promote_type.
Returns false
if self and the argument are equivalent. To be equivalent, they must have the same number of entries and each element in self must equal the corresponding element in the argument.
const RWMathVec< T > RWMathVec< T >::operator() | ( | const RWSlice & | s | ) | const [inline] |
Subscripting operators for the vector, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the vector being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
Subscripting operators for the vector, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the vector being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
T RWMathVec< T >::operator() | ( | int | i | ) | const [inline] |
Subscripting operators for the vector, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the vector being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
T & RWMathVec< T >::operator() | ( | int | i | ) | [inline] |
Subscripting operators for the vector, with optional bounds checking. Bounds checking is enabled by defining the preprocessor macro RWBOUNDS_CHECK
before including the header file. All subscripting operators return a new view of the same data as the vector being subscripted. An object of type RWRange or RWToEnd, the global object RWAll, or a character string may be substituted for an RWSlice.
Assignment by multiplication operator for vectors. The vectors must have the same dimensions. The expression implies
Assignment by multiplication operator for scalars. The expression implies
void RWMathVec< T >::operator++ | ( | int | ) | [inline] |
Increments each element of self. The functions taking an integer parameter are invoked if the operator is used as a postfix operator.
Reimplemented in RWMultiIndex.
Increments each element of self. The functions taking an integer parameter are invoked if the operator is used as a postfix operator.
Reimplemented in RWMultiIndex.
Assignment by addition operator for vectors. The vectors must have the same dimensions. The expression implies
Assignment by addition operator for scalars. The expression implies
void RWMathVec< T >::operator-- | ( | int | ) | [inline] |
Decrements each element of self. The functions taking an integer parameter are invoked if the operator is used as a postfix operator.
Decrements each element of self. The functions taking an integer parameter are invoked if the operator is used as a postfix operator.
Assignment by subtraction operator for vectors. The vectors must have the same dimensions. The expression implies
Assignment by subtraction operator for scalars. The expression implies
Assignment by division operator for vectors. The vectors must have the same dimensions. The expression implies
Assignment by division operator for scalars. The expression implies
Assignment operator for scalars. The expression implies
RWMathVec<T>& RWMathVec< T >::operator= | ( | const RWMathVecPick< T > & | v | ) |
Assignment operator for vectors. The vectors must have the same dimensions. The expression implies
Assignment operator for vectors. The vectors must have the same dimensions. The expression implies
Returns true
if self and the argument are equivalent. To be equivalent, they must have the same number of entries and each element in self must equal the corresponding element in the argument.
T RWMathVec< T >::operator[] | ( | int | i | ) | const [inline] |
T & RWMathVec< T >::operator[] | ( | int | i | ) | [inline] |
RWMathVecPick<T> RWMathVec< T >::pick | ( | const RWIntVec & | v | ) |
Returns a vector pick
. The results can be used as an lvalue. You can think of the picked elements as representing a vector in the order specified by the vector of indices v. Before using this function, you must include the header file rw/math/mthvecpk.h
.
Makes self a view of v's data. The view currently associated with the vector is lost.
void RWMathVec< T >::reshape | ( | size_t | n | ) |
Changes the length of the vector to n elements. After reshaping, the contents of the vector are undefined; that is, they can be and probably will be garbage.
void RWMathVec< T >::resize | ( | size_t | n | ) |
Changes the size of the vector to n elements, adding 0s or truncating as necessary.
void RWMathVec< T >::restoreFrom | ( | RWvistream & | ) |
Restores self from a virtual stream or an RWFile. To use these functions with a user-defined type T, the corresponding operator>>
must be defined:
RWvistream& operator>>(RWvistream& T&); RWFile& operator>>(RWFile&, T&);
Restores self from a virtual stream or an RWFile. To use these functions with a user-defined type T, the corresponding operator>>
must be defined:
RWvistream& operator>>(RWvistream& T&); RWFile& operator>>(RWFile&, T&);
void RWMathVec< T >::saveOn | ( | RWvostream & | ) | const |
Stores self to a virtual stream, or in a binary format to an RWFile. To use these functions with a user-defined type T, the corresponding operator<<
must be defined:
RWvostream& operator<<(RWvostream& T&); RWFile& operator<<(RWFile&, T&);
Stores self to a virtual stream, or in a binary format to an RWFile. To use these functions with a user-defined type T, the corresponding operator<<
must be defined:
RWvostream& operator<<(RWvostream& T&); RWFile& operator<<(RWFile&, T&);
Returns a vector which views a slice of the data. The slice begins at element start and extends for n elements. The increment between successive elements in the slice is stride.
int RWMathVec< T >::stride | ( | ) | const [inline] |
Returns the distance between successive elements of the vector. The stride can be computed using &v[i+1]-&v[i]
.
Reimplemented from RWVecView.
Returns the absolute values of each element.
double
. Therefore, if abs() is invoked for class RWMathVec<DComplex> , a vector of class RWMathVec<double> is returned. Returns the absolute values of each element.
Returns the absolute values of each element.
Returns the absolute values of each element.
Returns the absolute values of each element.
#include <rw/math/mathvec.h> #include <iostream> const double adata[] = {1.2,2.4,-1.2,0.8,-4.5}; int main() { RWMathVec<double> a(adata,5); RWMathVec<double> b = abs(a); std::cout << b; return 0; }
Program Output:
[ 1.2 2.4 1.2 0.8 4.5 ]
Returns arc cosines y such that . The yi(in radians) are in the range , for elements xi with absolute values .
Takes x as an argument and returns arc sines y such that . The yi (in radians) are in the range -, for elements xi with absolute values .
Takes x and returns y of arc tangents (in radians), such that , where .
At least one of the arguments xi or yi must be nonzero.
RWMathVec< T > atan2 | ( | const RWMathVec< T > & | x, | |
const RWMathVec< T > & | y | |||
) | [related] |
Takes two arguments and returns quadrant correct arc tangents z (in radians), such that . For each element i, the expression is mathematically equivalent to:
At least one of the arguments xi or yi must be nonzero.
Takes x as an argument and returns y such that yi corresponds to the next integer greater than or equal to xi. For example, if x = [ -1.3, 4.3, 7.9] then y = [ -1, 5, 8].
Takes complex x as an argument and returns the complex conjugates x*. For example, if xi = (2.3, 1.4), then xi* = (2.3, -1.4).
DComplex conjDot | ( | const RWMathVec< DComplex > & | x, | |
const RWMathVec< DComplex > & | y | |||
) | [related] |
Returns the complex-conjugate dot product of two vectors x and y:
The two vectors must have the same number of elements or an exception with value MATH_VNMATCH
occurs.
Takes x as an argument and returns y such that . The xi are in radians. For complex arguments, the complex cosine is returned.
Takes x as an argument and returns hyperbolic cosines y such that . For complex arguments, the complex hyperbolic cosine is returned.
Takes a vector x and returns a vector y of values corresponding to the cumulative sum of x:
#include <rw/math/mathvec.h> #include <iostream> int main() { const double adata[] = { 1.2, 2.4, -1.2, 0.8, 4.5 }; RWMathVec<double> a(adata, 5); RWMathVec<double> b = cumsum(a); std::cout << b; }
Program output:
[ 1.2 3.6 2.4 3.2 7.7]
Takes a vector x as an argument and returns a vector y of element differences. The first element in y is set equal to the first element of x. An element y(i) where i is not 0
is set equal to .
For example, if x = [2, 4, 5, 8] then y = [2, 2, 1, 3].
Returns the vector dot product z of two vectors, x and y. The two vectors must have the same number of elements or an exception with value MATH_VNMATCH
occurs.
For example, if x = [ 0, 1, 2] and y = [ 1, 3, 2], then z = 0 + 3 + 4 = 7. For vectors of type complex, see also function conjDot().
Takes an argument x and returns y such that:
If class T
is complex, the complex exponential is returned.
RWMathVec< DComplex > expandConjugateEven | ( | const RWMathVec< DComplex > & | ) | [related] |
Given a complex sequence points long, it is a complex conjugate-even sequence if:
,
Note that for a sequence to be complex conjugate-even, the imaginary parts of and must be 0. Given the lower half of the sequence, that is, this function expands it out to the entire sequence .
RWMathVec< DComplex > expandConjugateOdd | ( | const RWMathVec< DComplex > & | ) | [related] |
Given a complex sequence points long, it is a complex conjugate-odd sequence if:
.
Note that for a sequence to be complex conjugate-odd, the real parts of and must be 0. Given the lower half of the sequence, that is, this function expands it out to the entire sequence .
Given a real sequence points long, it is an even sequence if:
,
Given the lower half of an even sequence, that is, expandEven() expands it out to the entire sequence .
Given a real sequence points long, it is an odd sequence if:
.
Note that for a sequence to be odd, . Given the lower half of an odd sequence, that is, , expandOdd() expands it out to the entire sequence .
Takes x as an argument and returns y such that yi corresponds to the largest integer less than or equal to xi. For example, if x = [ 1.3, 4.4, -3.2], then y = [ 1, 4, -4].
Computes the Frobenius norm, which is the square root of the sum of squares of its entries. For a vector, the formula is:
float frobNorm | ( | const RWMathVec< float > & | v | ) | [related] |
Computes the Frobenius norm, which is the square root of the sum of squares of its entries. For a vector, the formula is:
double frobNorm | ( | const RWMathVec< double > & | v | ) | [related] |
Computes the Frobenius norm, which is the square root of the sum of squares of its entries. For a vector, the formula is:
Takes complex x as an argument and returns y containing the imaginary parts . With most versions of complex, the results can be used as an l-value:
RWMathVec<DComplex> v(5, 0); // (0, 0), (0, 0), ... imag(v) = 1.0; // (0, 1), (0, 1), ...
double kurtosis | ( | const RWMathVec< double > & | ) | [related] |
#include <rw/dstats.h>
Returns the kurtosis of a vector of doubles:
where <x> is the mean of the vector and is its standard deviation (that is, the square root of the variance). The -3 term is designed to make the kurtosis 0 for a normal distribution.
The function l1Norm() is the sum of absolute values of its entries:
float l1Norm | ( | const RWMathVec< float > & | v | ) | [related] |
The function l1Norm() is the sum of absolute values of its entries:
double l1Norm | ( | const RWMathVec< double > & | v | ) | [related] |
The function l1Norm() is the sum of absolute values of its entries:
The function l2Norm() is the square root of the sum of the squares of its entries:
float l2Norm | ( | const RWMathVec< float > & | v | ) | [related] |
The function l2Norm() is the square root of the sum of the squares of its entries:
double l2Norm | ( | const RWMathVec< double > & | v | ) | [related] |
The function l2Norm() is the square root of the sum of the squares of its entries:
The function linfNorm() is the maximum of absolute values of its entries:
float linfNorm | ( | const RWMathVec< float > & | v | ) | [related] |
The function linfNorm() is the maximum of absolute values of its entries:
double linfNorm | ( | const RWMathVec< double > & | v | ) | [related] |
The function linfNorm() is the maximum of absolute values of its entries:
Takes x as an argument and returns natural logarithms y such that . The arguments x i must not be 0. For complex arguments, the principal value of the complex natural logarithm is returned.
Takes x as an argument and returns base 10 logarithms y such that . The arguments x i must not be 0.
int maxIndex | ( | const RWMathVec< T > & | ) | [related] |
Return the index of the maximum element of the vector. If instead you want the maximum value use function maxValue().
Returns the value of the element with largest absolute value. Note that this is not a norm in the mathematical sense of the word.
float maxNorm | ( | const RWMathVec< float > & | v | ) | [related] |
Returns the value of the element with largest absolute value. Note that this is not a norm in the mathematical sense of the word.
double maxNorm | ( | const RWMathVec< double > & | v | ) | [related] |
Returns the value of the element with largest absolute value. Note that this is not a norm in the mathematical sense of the word.
T maxValue | ( | const RWMathVec< T > & | ) | [related] |
Return the maximum value.
T mean | ( | const RWMathVec< T > & | V | ) | [related] |
Takes a RWMathVec an argument and returns <x>, the mean value, where:
For example, if x = [1, 4, 3, 4], then <x> = 3.
int minIndex | ( | const RWMathVec< T > & | ) | [related] |
Return the index of the minimum element of the vector. If instead you want the minimum value use function minValue().
T minValue | ( | const RWMathVec< T > & | ) | [related] |
Return the minimum value.
Takes complex x as an argument and returns real y containing the norm:
Multiplication operator, applied element-by-element. For example, for scaler s, and vectors v, and w
, the expression implies .
Multiplication operator, applied element-by-element. For example, for vectors u, w
, and scaler s, the expression implies .
Addition operator, applied element-by-element. For example, for scaler s, and vectors v, and w
, the expression implies .
Addition operator, applied element-by-element. For example, for vectors u, w
, and scaler s, the expression implies .
RWMathVec< T > operator+ | ( | const RWMathVec< T > & | u, | |
const RWMathVec< T > & | v | |||
) | [related] |
Addition operator, applied element-by-element. For example, for vectors u, v, and w
, the expression implies .
Unary plus operator, applied element-by-element. For example, for vectors u
, and v, the expression implies .
Subtraction operator, applied element-by-element. For example, for vectors u, w
, and scaler s, the expression implies .
Subraction operator, applied element-by-element. For example, for scaler s
, and vectors v, and w
, the expression implies .
RWMathVec< T > operator- | ( | const RWMathVec< T > & | u, | |
const RWMathVec< T > & | v | |||
) | [related] |
Subtraction operator, applied element-by-element. For example, for vectors u, v, and w
, the expression implies .
Unary minus operator, applied element-by-element. For example, for vectors u
, and v, the expression implies .
Division operator, applied element-by-element. For example, for vectors u, w
, and scaler s, the expression implies .
Division operator, applied element-by-element. For example, for scaler s, and vectors v, and w
, the expression implies .
RWMathVec< T > operator/ | ( | const RWMathVec< T > & | u, | |
const RWMathVec< T > & | v | |||
) | [related] |
Division operator, applied element-by-element. For example, for vectors u, v, and w
, the expression implies .
std::ostream & operator<< | ( | std::ostream & | s, | |
const RWMathVec< T > & | v | |||
) | [related] |
Outputs a vector v to std::ostream s beginning with a left bracket [ and terminating with a right bracket
]. The output numbers are separated by spaces. If
T
is a user-defined type, the following operator must be defined for RWvostream and/or RWFile:
operator<<(ostream&s,constT&t);
std::istream & operator>> | ( | std::istream & | s, | |
RWMathVec< T > & | v | |||
) | [related] |
Reads vector v from stream s. It reads a sequence of numbers separated by white space. If the sequence of numbers begins with a left bracket [, the operator reads to a matching right bracket
]. If no left bracket is present, it reads to end of file. The vector v is initialized to the correct length. If
T
is a user-defined type, the following operator must be defined for RWvistream and/or RWFile:
operator>>(ostream&s,constT&t);
RWGenMat< T > outerProduct | ( | const RWMathVec< T > & | x, | |
const RWMathVec< T > & | y | |||
) | [related] |
Returns the outer product of two vectors. The outer product of the vectors and is the matrix A whose ijth entry is xiyj: that is, the jth column of A is yjx.
RWMathVec< T > pow | ( | const RWMathVec< T > & | x, | |
const RWMathVec< T > & | y | |||
) | [related] |
The function pow() takes two arguments: pow( x, y ).
Returns z such that:
If the number of elements in x does not match the number of elements in y, an exception with value RWMATH_MNMATCH
will occur.
T prod | ( | const RWMathVec< T > & | ) | [related] |
Takes a vector xi with n elements as an argument and returns the product of the elements of the vector. For example, if x = [1, 4, 3], then y = 12.
Takes a complex argument x and returns real y containing the real part . With most versions of complex, the results can be used as an l-value:
RWMathVec<DComplex> v(5, 0); // (0, 0), (0, 0), ... real(v) = 1.0; // (1, 0), (1, 0), ...
Takes a vector x as an argument and returns a vector y whose elements are in reversed order. For example, if x = [2, 5, 1, 6], then y = [6, 1, 5, 2]. The reversed vector y is actually a reversed slice of the original vector. Hence, the results of this function can be used as an lvalue.
Returns a complex vector v containing the complex Nth roots of unity, that is:
If rootsOfOne() is invoked with argument N, the N roots are returned in a vector of type RWMathVec<DComplex> with N elements.
Returns a complex vector v containing the complex Nth roots of unity, that is:
If rootsOfOne() is invoked with arguments N and nterms, only the the first nterms of the N roots are returned in a vector of type RWMathVec<DComplex> with nterms elements.
The function sin() takes x as an argument and returns y such that . The xi are in radians. For complex classes, the complex sine is returned.
The function sinh() takes x as an argument and returns y such that . For complex classes, the complex hyperbolic sine is returned.
double skewness | ( | const RWMathVec< double > & | ) | [related] |
#include <rw/dstats.h>
Returns the skewness of a vector of doubles:
where <x> is the mean of the vector and is its standard deviation, that is, the square root of the variance.
Returns the spectral variance of a Fourier transformed series. If v is a complex series containing the complex spectral estimates, the spectral variance S is given by:
Note that the first term, the mean, is excluded from the sum.
The square root function. Takes x as an argument and returns y such that . For complex classes, the principal value of the complex square root is returned.
T sum | ( | const RWMathVec< T > & | ) | [related] |
Returns the sum of the elements of the vector. For example, if x = [1, 4, 3, 4], then y = 12.
The function tan() takes argument x and returns y such that .
The function tanh() takes argument x and returns y such that .
Converts an RWMathVec<int> instance into a corresponding RWMathVec<signed char> instance. Note that this is a narrowing operation; high order bits are removed.
Converts an RWMathVec<double> instance into a corresponding RWMathVec<float> instance. Note that this is a narrowing operation; high order bits are removed.
Converts an RWMathVec<float> instance into a corresponding RWMathVec<int> instance. Note that truncation occurs.
Converts an RWMathVec<double> instance into a corresponding RWMathVec<int> instance. Note that truncation occurs.
float variance | ( | const RWMathVec< float > & | ) | [related] |
Takes a vector x as an argument and returns its variance y as in:
where <x> is the mean of the vector and N is the length of the vector. Note that this is the biased variance.
Takes a vector x as an argument and returns its variance y as in:
where <x> is the mean of the vector and N is the length of the vector. Note that this is the biased variance.
double variance | ( | const RWMathVec< double > & | ) | [related] |
Takes a vector x as an argument and returns its variance y as in:
where <x> is the mean of the vector and N is the length of the vector. Note that this is the biased variance.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.