|
| TVector () |
| Constructor. Creates a vector of length 0.
|
|
| TVector (int dim) |
| Constructor. Create a vector of length 'dim' and zero all elements. More...
|
|
| TVector (int dim, const VT s) |
| Constructor. Creates a vector of length 'dim' and set all values to 's'. More...
|
|
| TVector (int dim, VT *values, CopyMode cmode=DEEP_COPY) |
| Constructor. Create a vector of length 'dim' and initialise from 'values' array. More...
|
|
| TVector (int dim, const char *init) |
| Constructor. Create a vector of length 'dim' and initialise values from a text string. More...
|
|
| TVector (const TVector< VT > &v) |
| Copy constructor. Create vector as copy of another vector. More...
|
|
| TVector (const TVector< VT > &v, int ofs, int dim) |
| Reference constructor. Create a vector which shares its data block with vector v. More...
|
|
| ~TVector () |
| Destructor. Delete vector and deallocate data block.
|
|
int | Dim () const |
| Returns the size of the vector. More...
|
|
VT & | operator[] (int i) const |
| Vector element access operator (read and write) More...
|
|
TVector & | operator= (const TVector &v) |
| Assignment operator. More...
|
|
TVector & | operator= (VT s) |
| Scalar assignment. All vector elements are set to 's'.
|
|
void | Copy (const TVector &v) |
| Vector copy. Replaces the vector with a copy of 'v'. More...
|
|
void | Copy (const TVector &v, int tofs, int sofs, int n) |
| Partial vector copy. Replaces the vector with a part of 'v'. More...
|
|
void | New (int dim) |
| Resize the vector. More...
|
|
void | Clear () |
| Zeroes all elements. More...
|
|
void | Relink (const TVector &v) |
| Link the vector to the data block of another vector. More...
|
|
void | Relink (const TVector &v, int ofs, int n) |
| Link the vector to part of the data block of another vector. More...
|
|
void | Relink (VT *values, int dim) |
| Link vector to an external data array. More...
|
|
VT * | data_buffer () |
| Direct access to vector data array. More...
|
|
const VT * | data_buffer () const |
| Direct access to vector data array. More...
|
|
bool | Clip (VT vmin, VT vmax) |
| Truncate vector elements to specified range. More...
|
|
void | ShiftLeft (int n) |
| Move vector elements left. More...
|
|
void | ShiftRight (int n) |
| Move vector elements right. More...
|
|
TVector | operator+ (const TVector &v) const |
| Element-wise addition of vectors. More...
|
|
TVector | operator- (const TVector &v) const |
| Element-wise subtraction of vectors. More...
|
|
TVector | operator* (const TVector &v) const |
| Element-wise multiplication of vectors. More...
|
|
TVector | operator/ (const TVector &v) const |
| Element-wise division of vectors. More...
|
|
TVector | operator+ (const VT &s) const |
| Element-wise addition with a scalar. More...
|
|
TVector | operator- (const VT &s) const |
| Element-wise subtraction of a scalar. More...
|
|
TVector | operator* (const VT &s) const |
| Element-wise multiplication with a scalar. More...
|
|
TVector | operator/ (const VT &s) const |
| Element-wise division by a scalar. More...
|
|
TVector | operator- () const |
| Unary minus. More...
|
|
VT | operator& (const TVector &v) const |
| Dot product of two vectors. More...
|
|
TVector & | operator+= (const TVector &v) |
| Element-wise addition/assignment of vectors. More...
|
|
TVector & | operator-= (const TVector &v) |
| Element-wise subtraction/assignment of vectors. More...
|
|
TVector & | operator*= (const TVector &v) |
| Element-wise multiplication/assignment of vectors. More...
|
|
TVector & | operator/= (const TVector &v) |
| Element-wise division/assignment of vectors. More...
|
|
TVector & | operator+= (const VT &s) |
| Element-wise addition/assignment with a scalar. More...
|
|
TVector & | operator-= (const VT &s) |
| Element-wise subtraction/assignment of a scalar. More...
|
|
TVector & | operator*= (const VT &s) |
| Element-wise multiplication/assignment with a scalar. More...
|
|
TVector & | operator/= (const VT &s) |
| Element-wise division/assignment of a scalar. More...
|
|
void | Read (std::istream &is, int start=0, int n=-1) |
| Read vector from stream. More...
|
|
void | ReadIndexed (std::istream &is, int n=-1) |
| Read indexed vector elements from stream. More...
|
|
void | Scan (const char *cbuf, int nmax=0) |
| Initialise vector elements from a string. More...
|
|
|
bool | operator== (const TVector< VT > &v1, const TVector< VT > &v2) |
| Vector comparison (relational operator) More...
|
|
bool | operator!= (const TVector< VT > &v1, const TVector< VT > &v2) |
| Vector comparison (relational operator) More...
|
|
TVector< VT > | inv (const TVector< VT > &v) |
| Returns element-wise inverse vector 1/(*this)[i].
|
|
TVector< VT > | sqr (const TVector< VT > &v) |
| Returns element-wise square vector (*this)[i]^2.
|
|
TVector< VT > | sqrt (const TVector< VT > &v) |
| Returns element-wise square-root vector (*this)[i]^(1/2)
|
|
TVector< VT > | pow (const TVector< VT > &v, const VT &s) |
| Returns element-wise power vector (*this)[i]^s.
|
|
TVector< VT > | log (const TVector< VT > &v) |
| Returns element-wise natural logarithm vector ln((*this)[i])
|
|
TVector< VT > | exp (const TVector< VT > &v) |
| Returns element-wise base-e exponential vector exp((*this)[i])
|
|
TVector< VT > | conj (const TVector< VT > &v) |
| Returns element-wise complex conjugate vector ((*this([i].re, -(*this)[i].im)
|
|
TVector< VT > | sin (const TVector< VT > &v) |
| Returns element-wise sine vector sin((*this)[i])
|
|
TVector< VT > | cos (const TVector< VT > &v) |
| Returns element-wise cosine vector cos((*this)[i])
|
|
TVector< VT > | tan (const TVector< VT > &v) |
| Returns element-wise tangent vector tan((*this)[i])
|
|
TVector< VT > | asin (const TVector< VT > &v) |
| Returns element-wise arc sine vector asin((*this)[i])
|
|
TVector< VT > | acos (const TVector< VT > &v) |
| Returns element-wise arc cosine vector acos((*this)[i])
|
|
TVector< VT > | atan (const TVector< VT > &v) |
| Returns element-wise arc tangent vector atan((*this)[i])
|
|
TVector< VT > | sinh (const TVector< VT > &v) |
| Returns element-wise hyperbolic sine vector sinh((*this)[i])
|
|
TVector< VT > | cosh (const TVector< VT > &v) |
| Returns element-wise hyperbolic cosine vector cosh((*this)[i])
|
|
TVector< VT > | tanh (const TVector< VT > &v) |
| Returns element-wise hyperbolic tangent vector tanh((*this)[i])
|
|
TVector< VT > | asinh (const TVector< VT > &v) |
| Returns element-wise inverse hyperbolic sine vector asinh((*this)[i])
|
|
TVector< VT > | acosh (const TVector< VT > &v) |
| Returns element-wise inverse hyperbolic cosine vector acosh((*this)[i])
|
|
TVector< VT > | atanh (const TVector< VT > &v) |
| Returns element-wise inverse hyperbolic tangent vector atanh(v[i]) More...
|
|
VT | dot (const TVector< VT > &v1, const TVector< VT > &v2) |
| Dot product of two vectors. More...
|
|
VT | doth (const TVector< VT > &v1, const TVector< VT > &v2) |
| Hermitian product of two vectors. More...
|
|
VT | vmin (const TVector< VT > &v) |
| Extract smallest element in vector. More...
|
|
VT | vmax (const TVector< VT > &v) |
| Extract largest element in vector. More...
|
|
TVector< VT > | vsort (const TVector< VT > &v) |
| Sort vector. More...
|
|
void | vsort (const TVector< VT > &v, TVector< VT > &sorted_v, TVector< int > &sort_order) |
| Sort vector. More...
|
|
VT | sum (const TVector< VT > &v) |
| Sum of elements. More...
|
|
VT | mean (const TVector< VT > &v) |
| Mean value of elements. More...
|
|
VT | median (const TVector< VT > &v) |
| Median value of elements. More...
|
|
VT | variance (const TVector< VT > &v) |
| Variance of element values. More...
|
|
VT | stdv (const TVector< VT > &v) |
| Standard deviation of element values. More...
|
|
double | l1norm (const TVector< VT > &v) |
| L1 norm of vector elements. More...
|
|
double | l2norm (const TVector< VT > &v) |
| L2 norm of vector elements. More...
|
|
double | linfnorm (const TVector< VT > &v) |
| L-infinity norm of vector elements. More...
|
|
double | l2normsq (const TVector< VT > &v) |
| Square of L2 norm of vector elements. More...
|
|
double | length (const TVector< VT > &vec) |
| Length of a vector (L2 norm of elements) More...
|
|
TVector< VT > & | append (TVector< VT > &v1, const TVector< VT > &v2) |
| Concatenate two vectors. More...
|
|
TVector< VT > | cat (const TVector< VT > &v1, const TVector< VT > &v2) |
| Concatenate two vectors. More...
|
|
TVector< VT > | operator+ (const VT &s, const TVector< VT > &v) |
| Element-wise addition of a scalar from the left. More...
|
|
TVector< VT > | operator- (const VT &s, const TVector< VT > &v) |
| Element-wise subtraction from a scalar from the left. More...
|
|
TVector< VT > | operator* (const VT &s, const TVector< VT > &v) |
| Element-wise multiplication with a scalar from the left. More...
|
|
TVector< VT > | operator/ (const VT &s, const TVector< VT > &v) |
| Element-wise division of a scalar by a vector. More...
|
|
bool | visnan (const TVector< VT > &v) |
|
std::ostream & | operator<< (std::ostream &os, const TVector< VT > &v) |
| Write vector to output stream. More...
|
|
std::istream & | operator>> (std::istream &is, TVector< VT > &v) |
| Read vector from input stream. More...
|
|
VT | SparseDotp (const TVector< VT > &v1, idxtype *idx1, int nidx1, const TVector< VT > &v2, idxtype *idx2, int nidx2, int from, int to) |
| Sparse dot product of two vectors. More...
|
|
TVector< double > | UnfoldComplex (const TVector< VT > &v) |
| Unfold real and imaginary parts of a complex vector. More...
|
|
template<class VT>
class TVector< VT >
Templated vector class.
Vectors consist of a header block and a dynamically allocated data block. Multiple vectors can share a common data block (or parts thereof). Any changes to a common data block affect all associated vectors simultaneously.
The following template types are instantiated by default: