SourcePro® 2024.1 |
SourcePro® API Reference Guide |
A templatized vector class. More...
#include <rw/math/mathvec.h>
Public Types | |
typedef RWMathVecConstIterator< T > | const_iterator |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
typedef RWMathVecIterator< T > | iterator |
typedef rw_numeric_traits< T >::mathFunType | mathFunType |
typedef rw_numeric_traits< T >::mathFunType2 | mathFunType2 |
typedef rw_numeric_traits< T >::norm_type | norm_type |
typedef rw_numeric_traits< T >::promote_type | promote_type |
typedef std::reverse_iterator< iterator > | reverse_iterator |
Public Types inherited from RWDataView | |
enum | Storage { COLUMN_MAJOR , ROW_MAJOR , RWEITHER } |
Public Member Functions | |
RWMathVec () | |
RWMathVec (const char *s) | |
RWMathVec (const RWMathVec< double > &re, const RWMathVec< double > &im) | |
RWMathVec (const RWMathVec< T > &a) | |
RWMathVec (const RWMathVecPick< T > &p) | |
RWMathVec (const T *dat, size_t n) | |
RWMathVec (size_t n, const T &initval) | |
RWMathVec (size_t n, const T &initval, const T &incr) | |
RWMathVec (size_t n, RWRandInterface &r) | |
RWMathVec (size_t n, RWUninitialized) | |
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 |
const_iterator | cbegin () const |
const_iterator | cend () const |
RWMathVec< T > | copy () const |
const_reverse_iterator | crbegin () const |
const_reverse_iterator | crend () const |
T * | data () |
const T * | data () const |
RWMathVec< T > | deepCopy () const |
void | deepenShallowCopy () |
iterator | end () |
const_iterator | end () const |
size_t | length () const |
operator RWMathVec< promote_type > () | |
bool | operator!= (const RWMathVec< T > &v) const |
RWMathVec< T > | operator() (const RWSlice &) |
const RWMathVec< T > | operator() (const RWSlice &) const |
T & | operator() (int i) |
T | operator() (int i) const |
RWMathVec< T > & | operator*= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator*= (const T &v) |
RWMathVec< T > & | operator++ () |
void | operator++ (int) |
RWMathVec< T > & | operator+= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator+= (const T &v) |
RWMathVec< T > & | operator-- () |
void | operator-- (int) |
RWMathVec< T > & | operator-= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator-= (const T &v) |
RWMathVec< T > & | operator/= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator/= (const T &v) |
RWMathVec< T > & | operator= (const RWMathVec< T > &v) |
RWMathVec< T > & | operator= (const RWMathVecPick< T > &v) |
RWMathVec< T > & | operator= (const T &v) |
bool | operator== (const RWMathVec< T > &) const |
RWMathVec< T > | operator[] (const RWSlice &) |
const RWMathVec< T > | operator[] (const RWSlice &) const |
T & | operator[] (int i) |
T | operator[] (int i) const |
RWMathVecPick< T > | pick (const RWIntVec &v) |
reverse_iterator | rbegin () |
const_reverse_iterator | rbegin () const |
RWMathVec< T > & | reference (const RWMathVec< T > &v) |
reverse_iterator | rend () |
const_reverse_iterator | rend () const |
void | reshape (size_t n) |
void | resize (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 |
Public Member Functions inherited from RWVecView | |
size_t | length () const |
int | stride () const |
Friends | |
RWMathVec< double > | imag (const RWMathVec< DComplex > &v) |
RWMathVec< double > | real (const RWMathVec< DComplex > &v) |
class | RWGenMat< T > |
Related Symbols | |
(Note that these are not member symbols.) | |
RWMathVec< double > | abs (const RWMathVec< DComplex > &) |
RWMathVec< double > | abs (const RWMathVec< double > &) |
RWMathVec< float > | abs (const RWMathVec< float > &) |
RWMathVec< int > | abs (const RWMathVec< int > &) |
RWMathVec< signed char > | abs (const RWMathVec< signed char > &) |
template<class T > | |
RWMathVec< T > | acos (const RWMathVec< T > &x) |
RWMathVec< double > | arg (const RWMathVec< DComplex > &v) |
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) |
RWMathVec< DComplex > | conj (const RWMathVec< DComplex > &x) |
DComplex | conjDot (const RWMathVec< DComplex > &x, const RWMathVec< DComplex > &y) |
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 > | 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 > | |
RWMathVec< T > | exp (const RWMathVec< T > &x) |
RWMathVec< DComplex > | expandConjugateEven (const RWMathVec< DComplex > &) |
RWMathVec< DComplex > | expandConjugateOdd (const RWMathVec< DComplex > &) |
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) |
double | frobNorm (const RWMathVec< DComplex > &v) |
double | frobNorm (const RWMathVec< double > &v) |
float | frobNorm (const RWMathVec< float > &v) |
double | kurtosis (const RWMathVec< double > &) |
double | l1Norm (const RWMathVec< DComplex > &v) |
double | l1Norm (const RWMathVec< double > &v) |
float | l1Norm (const RWMathVec< float > &v) |
double | l2Norm (const RWMathVec< DComplex > &v) |
double | l2Norm (const RWMathVec< double > &v) |
float | l2Norm (const RWMathVec< float > &v) |
double | linfNorm (const RWMathVec< DComplex > &v) |
double | linfNorm (const RWMathVec< double > &v) |
float | linfNorm (const RWMathVec< float > &v) |
template<class T > | |
RWMathVec< T > | log (const RWMathVec< T > &x) |
template<class T > | |
RWMathVec< T > | log10 (const RWMathVec< T > &x) |
template<class T > | |
int | maxIndex (const RWMathVec< T > &) |
double | maxNorm (const RWMathVec< DComplex > &v) |
double | maxNorm (const RWMathVec< double > &v) |
float | maxNorm (const RWMathVec< float > &v) |
template<class T > | |
T | maxValue (const RWMathVec< T > &) |
template<class T > | |
T | mean (const RWMathVec< T > &V) |
template<class T > | |
int | minIndex (const RWMathVec< T > &) |
template<class T > | |
T | minValue (const RWMathVec< T > &) |
RWMathVec< double > | norm (const RWMathVec< DComplex > &x) |
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 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 > &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 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 > &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 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 > | |
RWGenMat< T > | outerProduct (const RWMathVec< T > &x, const RWMathVec< T > &y) |
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 > | |
T | prod (const RWMathVec< T > &) |
template<class T > | |
RWMathVec< T > | reverse (const RWMathVec< T > &) |
RWMathVec< DComplex > | rootsOfOne (int N) |
Returns a complex vector v containing the complex Nth roots of unity. | |
RWMathVec< DComplex > | rootsOfOne (int N, size_t nterms) |
Returns a complex vector v containing the complex Nth roots of unity. | |
template<class T > | |
RWMathVec< T > | sin (const RWMathVec< T > &V) |
template<class T > | |
RWMathVec< T > | sinh (const RWMathVec< T > &V) |
double | skewness (const RWMathVec< double > &) |
RWMathVec< double > | sort (const RWMathVec< double > &) |
double | spectralVariance (const RWMathVec< DComplex > &) |
template<class T > | |
RWMathVec< T > | sqrt (const RWMathVec< T > &V) |
template<class T > | |
T | sum (const RWMathVec< T > &) |
template<class T > | |
RWMathVec< T > | tan (const RWMathVec< T > &V) |
template<class T > | |
RWMathVec< T > | tanh (const RWMathVec< T > &V) |
RWMathVec< signed char > | toChar (const RWMathVec< int > &v) |
RWMathVec< float > | toFloat (const RWMathVec< double > &v) |
RWMathVec< int > | toInt (const RWMathVec< double > &v) |
RWMathVec< int > | toInt (const RWMathVec< float > &v) |
double | variance (const RWMathVec< DComplex > &) |
double | variance (const RWMathVec< double > &) |
float | variance (const RWMathVec< float > &) |
Class RWMathVec is a templatized vector class.
typedef RWMathVecConstIterator<T> RWMathVec< T >::const_iterator |
A type that provides a const
random-access iterator over the elements in the container.
typedef std::reverse_iterator<const_iterator> RWMathVec< T >::const_reverse_iterator |
A type that provides a const
random-access, reverse-order iterator over the elements in the container.
typedef RWMathVecIterator<T> RWMathVec< T >::iterator |
A type that provides a random-access iterator over the elements in the container.
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.
A type that provides a random-access, reverse-order iterator over the elements in the container.
RWMathVec< T >::RWMathVec | ( | size_t | n, |
RWRandInterface & | r ) |
Constructs a vector with n elements initialized with random numbers generated by r.
|
inline |
|
inline |
Copy constructor. The new vector and the old vector both view the same data.
|
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.
RWMathVec< T >::RWMathVec | ( | size_t | n, |
const T & | initval ) |
Constructs a vector with n elements, initialized to initval.
RWMathVec< T >::RWMathVec | ( | size_t | n, |
const T & | initval, | ||
const T & | incr ) |
Constructs a vector with n elements. The first has value initval; each succeeding element is incremented by incr.
RWMathVec< T >::RWMathVec | ( | const char * | s | ) |
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. A copy of p's data is made.
RWMathVec< T >::RWMathVec | ( | const T * | dat, |
size_t | n ) |
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.
|
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.
Returns an iterator that points to the first element in the vector.
|
inline |
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&).
|
inline |
Returns an iterator that points to the first element in the vector.
|
inline |
Returns an iterator that points to one element past the last element in the vector.
Returns a copy with distinct instance variables.
|
inline |
Returns an iterator that points to the first element in the vector.
|
inline |
Returns an iterator that points to one element past the first element in the vector.
|
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.
|
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.
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.
Returns an iterator that points to one element past the last element in the vector.
|
inline |
Returns an iterator that points to one element past the last element in the vector.
|
inline |
Returns the number of elements in the vector.
|
inline |
Implicit conversion operator to RWMathVec. The promote_type
is rw_numeric_traits::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.
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.
|
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.
|
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.
|
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 this *= v
implies \(this_{i} = this_{i} * v_{i}\)
Assignment by multiplication operator for scalars. The expression this *= v
implies \(this_{i} = this_{i} * v\)
Increments each element of self. The functions taking an integer parameter are invoked if the operator is used as a postfix operator.
|
inline |
Increments each element of self. The functions taking an integer parameter are invoked if the operator is used as a postfix operator.
Assignment by addition operator for vectors. The vectors must have the same dimensions. The expression this += v
implies \(this_{i} = this_{i} + v_{i}\)
Assignment by addition operator for scalars. The expression this += v
implies \(this_{i} = this_{i} + v\)
Decrements each element of self. The functions taking an integer parameter are invoked if the operator is used as a postfix operator.
|
inline |
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 this -= v
implies \(this_{i} = this_{i} - v_{i}\)
Assignment by subtraction operator for scalars. The expression this -= v
implies \(this_{i} = this_{i} - v\)
Assignment by division operator for vectors. The vectors must have the same dimensions. The expression this /= v;
implies \(this_{i} = this_{i} / v_{i}\)
Assignment by division operator for scalars. The expression this /= v
implies \(this_{i} = this_{i} / v\)
Assignment operator for vectors. The vectors must have the same dimensions. The expression this = v
implies \(this_{i} = v_{i}\)
RWMathVec< T > & RWMathVec< T >::operator= | ( | const RWMathVecPick< T > & | v | ) |
Assignment operator for vectors. The vectors must have the same dimensions. The expression this = v
implies \(this_{i} = v_{i}\)
Assignment operator for scalars. The expression this = v
implies \(this_{i} = v\)
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.
|
inline |
|
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
.
|
inline |
Returns an iterator that points to the last element in the vector.
|
inline |
Returns an iterator that points to the first element in the vector.
Makes self a view of v's data. The view currently associated with the vector is lost.
|
inline |
Returns an iterator that points to one element past the first element in the vector.
|
inline |
Returns an iterator that points to one element past the first element in the vector.
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.
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:
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:
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:
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:
RWMathVec< T > RWMathVec< T >::slice | ( | int | start, |
size_t | n, | ||
int | stride = 1 ) const |
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.
|
inline |
Returns the distance between successive elements of the vector. The stride can be computed using &v[i+1]-&v[i]
.
Returns the absolute values of each element.
Returns the absolute values of each element.
Program Output:
Returns the absolute values of each element.
Returns the absolute values of each element.
Returns arc cosines y such that \(y_{i} = cos^{-1} (x_{i})\). The yi(in radians) are in the range \(0 < y_{i} \leq \pi\), for elements xi with absolute values \(|x_{i}| \leq 1\).
Takes x as an argument and returns arc sines y such that \(y_{i} = sin^{-1} (x_{i})\). The yi (in radians) are in the range \(-\pi/2 < y_{i} \leq \pi/2\), for elements xi with absolute values \(|x_{i}| \leq 1\).
Takes x and returns y of arc tangents (in radians), such that \(y_{i} = tan^{-1}x_{i}\), where \(-\pi/2 < y_{i} \leq \pi/2\).
At least one of the arguments xi or yi must be nonzero.
|
related |
Takes two arguments and returns quadrant correct arc tangents z (in radians), such that \(z_{i} = tan^{-1} ( x_{i}/y_{i})\). For each element i, the expression \(atan2(x_{i}, y_{i})\) is mathematically equivalent to:
\[ tan^{-1}\left(\frac{x_i}{y_i}\right) \]
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).
|
related |
Returns the complex-conjugate dot product of two vectors x and y:
\[ z = \sum_{j=0}^{N-1} x_j y_j \]
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 \(y_{i} = cos(x_{i})\). 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 \(y_{i} = cosh(x_{i})\). 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:
\[ y_i = \sum_{j=0}^{i} x_j \]
Program output:
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 \(x(i) - x(i-1)\).
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.
\[ z = \sum_{j=0}^{N-1} x_j y_j \]
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:
\[ y_i = e^{x_i} \]
If class T
is complex, the complex exponential is returned.
|
related |
Given a complex sequence \(C(n), n=0, \ldots , 2N\) points long, it is a complex conjugate-even sequence if:
\[ C(n) = conj[C(-n)] = conj[C(2N - n)] \]
,
Note that for a sequence to be complex conjugate-even, the imaginary parts of \(C(0)\) and \(C(N)\) must be 0. Given the lower half of the sequence, that is, \(C(n), n=0, \ldots , N\), this function expands it out to the entire sequence \(C(n), n=0, ..., 2N\).
|
related |
Given a complex sequence \(C(n), n=0, \ldots, 2N\) points long, it is a complex conjugate-odd sequence if:
\[ C(n) = - conj[C(-n)] = - conj[C(2N - n)] \]
.
Note that for a sequence to be complex conjugate-odd, the real parts of \(C(0)\) and \(C(N)\) must be 0. Given the lower half of the sequence, that is, \(C(n), n=0, \ldots , N\), this function expands it out to the entire sequence \(C(n), n=0, ..., 2N\).
Given a real sequence \(V(n), n=0, \ldots , 2N\) points long, it is an even sequence if:
\[ V(n) = V(-n) = V(2N - n) \]
Given the lower half of an even sequence, that is, \(V(n), n=0, \ldots , N\), expandEven() expands it out to the entire sequence \(V(n), n=0, \ldots, 2N\).
Given a real sequence \(V(n), n=0, \ldots , 2N\) points long, it is an odd sequence if:
\[ V(n) = - V(-n) = - V(2N - n) \]
Note that for a sequence to be odd, \(V(0) = V(N) = 0\). Given the lower half of an odd sequence, that is, \(V(n), n=1, \ldots , N-1\), expandOdd() expands it out to the entire sequence \(V(n), n=0, \ldots , 2N\).
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:
\[ \left \| x \right \|_{\text{Frob}} = \sqrt{\sum_{i=0}^{N-1}\left | x_{i} \right |^2} \]
|
related |
Computes the Frobenius norm, which is the square root of the sum of squares of its entries. For a vector, the formula is:
\[ \left \| x \right \|_{\text{Frob}} = \sqrt{\sum_{i=0}^{N-1}\left | x_{i} \right |^2} \]
|
related |
Computes the Frobenius norm, which is the square root of the sum of squares of its entries. For a vector, the formula is:
\[ \left \| x \right \|_{\text{Frob}} = \sqrt{\sum_{i=0}^{N-1}\left | x_{i} \right |^2} \]
Takes complex x as an argument and returns y containing the imaginary parts \(y_{i} = Im(x_{i})\). With most versions of complex, the results can be used as an l-value:
|
related |
Returns the kurtosis of a vector of doubles:
\[ \frac{1}{N}\sum_{i=0}^{N-1}\left ( \frac{x_i - \langle x \rangle}{\sigma} \right )^4 - 3 \]
where <x> is the mean of the vector and \( \sigma \) 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:
\[ \left \| x \right \| = \sum_{i=0}^{N-1}\left | x_i \right | \]
|
related |
The function l1Norm() is the sum of absolute values of its entries:
\[ \left \| x \right \| = \sum_{i=0}^{N-1}\left | x_i \right | \]
|
related |
The function l1Norm() is the sum of absolute values of its entries:
\[ \left \| x \right \| = \sum_{i=0}^{N-1}\left | x_i \right | \]
The function l2Norm() is the square root of the sum of the squares of its entries:
\[ \left \| x \right \|_2 = \sqrt{ \sum_{i=0}^{N-1} \left (x_i \right )^2 } \]
|
related |
The function l2Norm() is the square root of the sum of the squares of its entries:
\[ \left \| x \right \|_2 = \sqrt{ \sum_{i=0}^{N-1} \left (x_i \right )^2 } \]
|
related |
The function l2Norm() is the square root of the sum of the squares of its entries:
\[ \left \| x \right \|_2 = \sqrt{ \sum_{i=0}^{N-1} \left (x_i \right )^2 } \]
The function linfNorm() is the maximum of absolute values of its entries:
\[ \left \| x \right \|_{\infty} = \begin{array}{c c} \scriptstyle max \\ \scriptstyle j=0,...,N-1 \end{array} \left | x_i \right | \]
|
related |
The function linfNorm() is the maximum of absolute values of its entries:
\[ \left \| x \right \|_{\infty} = \begin{array}{c c} \scriptstyle max \\ \scriptstyle j=0,...,N-1 \end{array} \left | x_i \right | \]
|
related |
The function linfNorm() is the maximum of absolute values of its entries:
\[ \left \| x \right \|_{\infty} = \begin{array}{c c} \scriptstyle max \\ \scriptstyle j=0,...,N-1 \end{array} \left | x_i \right | \]
Takes x as an argument and returns natural logarithms y such that \(y_{i}=log(x_{i})\). 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 \(y_{i} = log_{10}(x_{i})\). The arguments x i must not be 0.
|
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.
|
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.
|
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.
|
related |
Return the maximum value.
|
related |
Takes a RWMathVec an argument and returns <x>, the mean value, where:
\[ \langle x \rangle = \frac{1}{n}\sum_{i=0}^{n-1}x_i \]
For example, if x = [1, 4, 3, 4], then <x> = 3.
|
related |
Return the index of the minimum element of the vector. If instead you want the minimum value use function minValue().
|
related |
Return the minimum value.
Takes complex x as an argument and returns real y containing the norm:
\[ y_{i} = [Re(x_{i})]^{2} + [Im(x_{i}]^{2} \]
Multiplication operator, applied element-by-element. For example, for vectors u, w
, and scaler s, the expression w = u * s
implies \(w_{i} = u_{i} * s\).
Multiplication operator, applied element-by-element. For example, for scaler s, and vectors v, and w
, the expression w = s * v
implies \(w_{i} = s * v_{i}\).
|
related |
Addition operator, applied element-by-element. For example, for vectors u, v, and w
, the expression w = u + v
implies \(w_{i} = u_{i} + v_{i}\).
Addition operator, applied element-by-element. For example, for vectors u, w
, and scaler s, the expression w = u + s
implies \(w_{i} = u_{i} + s\).
Unary plus operator, applied element-by-element. For example, for vectors u
, and v, the expression u = +v
implies \(u_{i} = +v_{i}\).
Addition operator, applied element-by-element. For example, for scaler s, and vectors v, and w
, the expression w = s + v
implies \(w_{i} = s + v_{i}\).
|
related |
Subtraction operator, applied element-by-element. For example, for vectors u, v, and w
, the expression w = u - v
implies \(w_{i} = u_{i} - v_{i}\).
Subtraction operator, applied element-by-element. For example, for vectors u, w
, and scaler s, the expression w = u - s
implies \(w_{i} = u_{i} - s\).
Unary minus operator, applied element-by-element. For example, for vectors u
, and v, the expression u = -v
implies \(u_{i} = -v_{i}\).
Subraction operator, applied element-by-element. For example, for scaler s
, and vectors v, and w
, the expression w = s - v
implies \(w_{i} = s - v_{i}\).
|
related |
Division operator, applied element-by-element. For example, for vectors u, v, and w
, the expression w = u / v
implies \(w_{i} = u_{i} / v_{i}\).
Division operator, applied element-by-element. For example, for vectors u, w
, and scaler s, the expression w = u / s
implies \(w_{i} = u_{i} / s\).
Division operator, applied element-by-element. For example, for scaler s, and vectors v, and w
, the expression w = s / v
implies \(w_{i} = s / v_{i}\).
|
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);
|
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);
|
related |
Returns the outer product of two vectors. The outer product of the vectors \(x = (x_{1}, x_{2},\ldots , x_{n})\) and \(y = (y_{1}, y_{2},\ldots , y_{m})\) is the matrix A whose ijth entry is xiyj: that is, the jth column of A is yjx.
|
related |
The function pow() takes two arguments: pow( x, y ).
Returns z such that:
\[ z_i = (x_i)^{y_i} \]
If the number of elements in x does not match the number of elements in y, an exception with value RWMATH_MNMATCH
will occur.
|
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 \(y_{i}=Re(x_{i})\). With most versions of complex, the results can be used as an l-value:
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:
\[ \begin{array}{l r} v_k = e^{(2k\pi) / N} & \text{ k = 0, ..., nterms - 1} \end{array} \]
If rootsOfOne() is invoked with argument N, the N roots are returned in a vector of type RWMathVec with N elements.
Returns a complex vector v containing the complex Nth roots of unity, that is:
\[ \begin{array}{l r} v_k = e^{(2k\pi) / N} & \text{ k = 0, ..., nterms - 1} \end{array} \]
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 with nterms elements.
The function sin() takes x as an argument and returns y such that \(y_{i} = sin(x_{i})\). 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 \(y_{i} = sinh(x_{i})\). For complex classes, the complex hyperbolic sine is returned.
|
related |
Returns the skewness of a vector of doubles:
\[ \frac{1}{N}\sum_{i=0}^{N-1}\left ( \frac{x_{i}-\left \langle x \right \rangle}{\sigma} \right )^3 \]
where <x> is the mean of the vector and \( \sigma \) is its standard deviation, that is, the square root of the variance.
Returns a sorted vector, smallest to largest.
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:
\[ \text{S} = \sum_{i=0}^{N-1}\left ( \text{Re}(v_{i})^2 + \text{Im}(v_{i})^2 \right ) \]
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 \(y_{i} = (x_{i})^{1/2}\). For complex classes, the principal value of the complex square root is returned.
|
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 \(y_{i} = tan(x_{i})\).
The function tanh() takes argument x and returns y such that \(y_{i} = tanh(x_{i})\).
Converts an RWMathVec instance into a corresponding RWMathVec instance. Note that this is a narrowing operation; high order bits are removed.
Converts an RWMathVec instance into a corresponding RWMathVec instance. Note that this is a narrowing operation; high order bits are removed.
Converts an RWMathVec instance into a corresponding RWMathVec instance. Note that truncation occurs.
Converts an RWMathVec instance into a corresponding RWMathVec instance. Note that truncation occurs.
Takes a vector x as an argument and returns its variance y as in:
\[ y=\frac{1}{N}\sum_{i=0}^{N-1}(x_i-<x>)^2 \]
where <x> is the mean of the vector and N is the length of the vector. Note that this is the biased variance.
|
related |
Takes a vector x as an argument and returns its variance y as in:
\[ y=\frac{1}{N}\sum_{i=0}^{N-1}(x_i-<x>)^2 \]
where <x> is the mean of the vector and N is the length of the vector. Note that this is the biased variance.
|
related |
Takes a vector x as an argument and returns its variance y as in:
\[ y=\frac{1}{N}\sum_{i=0}^{N-1}(x_i-<x>)^2 \]
where <x> is the mean of the vector and N is the length of the vector. Note that this is the biased variance.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |