itpp::Vec< Num_T > Class Template Reference
Base Module » Array, Vector and Matrix Classes

Vector Class (Templated) More...

`#include <itpp/base/vec.h>`

## Public Types

typedef Num_T | value_type
| The type of the vector values.

## Public Member Functions

| Vec (const Factory &f=DEFAULT_FACTORY)
| Default constructor. An element factory `f` can be specified.
| Vec (int size, const Factory &f=DEFAULT_FACTORY)
| Constructor with size parameter. An element factory `f` can be specified.
| Vec (const Vec< Num_T > &v)
| Copy constructor.
| Vec (const Vec< Num_T > &v, const Factory &f)
| Copy constructor, which takes an element factory `f` as an additional argument.
| Vec (const char *str, const Factory &f=DEFAULT_FACTORY)
| Constructor taking a char string as input. An element factory `f` can be specified.
| Vec (const std::string &str, const Factory &f=DEFAULT_FACTORY)
| Constructor taking a string as input. An element factory `f` can be specified.
| Vec (const Num_T *c_array, int size, const Factory &f=DEFAULT_FACTORY)
| Constructor taking a C-array as input. Copies all data. An element factory `f` can be specified.
| ~Vec ()
| Destructor.
int | length () const
| The size of the vector.
int | size () const
| The size of the vector.
void | set_size (int size, bool copy=false)
| Set length of vector. if copy = true then keeping the old values.
void | set_length (int size, bool copy=false)
| Set length of vector. if copy = true then keeping the old values.
void | zeros ()
| Set the vector to the all zero vector.
void | clear ()
| Set the vector to the all zero vector.
void | ones ()
| Set the vector to the all one vector.
void | set (const char *str)
| Set the vector equal to the values in the `str` string.
void | set (const std::string &str)
| Set the vector equal to the values in the `str` string.
const Num_T & | operator[] (int i) const
| C-style index operator. First element is 0.
const Num_T & | operator() (int i) const
| Index operator. First element is 0.
Num_T & | operator[] (int i)
| C-style index operator. First element is 0.
Num_T & | operator() (int i)
| Index operator. First element is 0.
Vec< Num_T > | operator() (int i1, int i2) const
| Sub-vector with elements from `i1` to `i2`. Index -1 indicates the last element.
Vec< Num_T > | operator() (const Vec< int > &indexlist) const
| Sub-vector with elements given by the list of indices `indexlist`.
Vec< Num_T > | operator() (const Vec< bin > &binlist) const
| Sub-vector with elements with indexes where `binlist` is `1`.
const Num_T & | get (int i) const
| Accessor-style method. First element is 0.
Vec< Num_T > | get (int i1, int i2) const
| Get the elements from `i1` to `i2`. Index -1 indicates the last element.
Vec< Num_T > | get (const Vec< int > &indexlist) const
| Get the elements given by the list of indices `indexlist`.
Vec< Num_T > | get (const Vec< bin > &binlist) const
| Get the elements with indexes where `binlist` is `1`.
void | set (int i, Num_T t)
| Modifier-style method. First element is 0.
Mat< Num_T > | transpose () const
| Matrix transpose. Converts to a matrix with the vector in the first row.
Mat< Num_T > | T () const
| Matrix transpose. Converts to a matrix with the vector in the first row.
Mat< Num_T > | hermitian_transpose () const
| Hermitian matrix transpose. Converts to a matrix with the conjugate of the vector in the first row.
Mat< Num_T > | H () const
| Hermitian matrix transpose. Converts to a matrix with the conjugate of the vector in the first row.
Vec< Num_T > & | operator+= (const Vec< Num_T > &v)
| Addition of vector.
Vec< Num_T > & | operator+= (Num_T t)
| Addition of scalar.
Vec< Num_T > & | operator-= (const Vec< Num_T > &v)
| Subtraction of vector.
Vec< Num_T > & | operator-= (Num_T t)
| Subtraction of scalar.
Vec< Num_T > & | operator*= (Num_T t)
| Multiply with a scalar.
Vec< Num_T > & | operator/= (Num_T t)
| Elementwise division.
Vec< Num_T > & | operator/= (const Vec< Num_T > &v)
| Elementwise division.
Vec< Num_T > | right (int nr) const
| Get the right `nr` elements from the vector.
Vec< Num_T > | left (int nr) const
| Get the left `nr` elements from the vector.
Vec< Num_T > | mid (int start, int nr) const
| Get the middle part of vector from `start` including `nr` elements.
Vec< Num_T > | split (int pos)
| Split the vector into two parts at element `pos`.
void | shift_right (Num_T t, int n=1)
| Shift in element `t` at position 0 `n` times.
void | shift_right (const Vec< Num_T > &v)
| Shift in vector `v` at position 0.
void | shift_left (Num_T t, int n=1)
| Shift out the `n` left elements and at the same time shift in the element `t` at last position `n` times.
void | shift_left (const Vec< Num_T > &v)
| Shift in vector `v` at last positions.
void | set_subvector (int i1, int i2, const Vec< Num_T > &v)
| This function is deprecated. Please use set_subvector(i, v) instead.
void | set_subvector (int i, const Vec< Num_T > &v)
| Set subvector to elements of vector `v` starting from element `i`.
void | set_subvector (int i1, int i2, Num_T t)
| Set subvector defined by indices `i1` and `i2` to `t`.
void | replace_mid (int i, const Vec< Num_T > &v)
| An alias function of set_subvector(i, &v)
void | del (int i)
| Delete element number `i`.
void | del (int i1, int i2)
| Delete elements from `i1` to `i2`.
void | ins (int i, Num_T t)
| Insert element `t` before element with index `i` (0 <= i <= datasize)
void | ins (int i, const Vec< Num_T > &v)
| Insert vector `v` before element with index `i` (0 <= i <= datasize)
Vec< Num_T > & | operator= (Num_T t)
| Assign all elements in vector to `t`.
Vec< Num_T > & | operator= (const Vec< Num_T > &v)
| Assign vector the value and length of `v`.
Vec< Num_T > & | operator= (const Mat< Num_T > &m)
| Assign vector equal to the 1-dimensional matrix `m`.
Vec< Num_T > & | operator= (const char *str)
| Assign vector the values in the string `str`.
Vec< Num_T > & | operator= (const std::string &str)
| Assign vector the values in the string `str`.
Vec< bin > | operator== (Num_T t) const
| Elementwise equal to the scalar `t`.
Vec< bin > | operator!= (Num_T t) const
| Elementwise not-equal to the scalar `t`.
Vec< bin > | operator< (Num_T t) const
| Elementwise less than the scalar `t`.
Vec< bin > | operator<= (Num_T t) const
| Elementwise less than and equal to the scalar `t`.
Vec< bin > | operator> (Num_T t) const
| Elementwise greater than the scalar `t`.
Vec< bin > | operator>= (Num_T t) const
| Elementwise greater than and equal to the scalar `t`.
bool | operator== (const Vec< Num_T > &v) const
| Compare with vector `v`. Return false if sizes or values differ.
bool | operator!= (const Vec< Num_T > &v) const
| Compare with vector `v`. Return true if sizes or values differ.
Num_T & | _elem (int i)
| Index operator without boundary check. Not recommended for use.
const Num_T & | _elem (int i) const
| Index operator without boundary check. Not recommended for use.
Num_T * | _data ()
| Get the pointer to the internal structure. Not recommended for use.
const Num_T * | _data () const
| Get the pointer to the internal structure. Not recommended for use.

## Protected Member Functions

void | alloc (int size)
| Allocate storage for a vector of length `size`.
void | free ()
| Free the storage space allocated by the vector.

## Protected Attributes

int | datasize
| The current number of elements in the vector.
Num_T * | data
| A pointer to the data area.
const Factory & | factory
| Element factory (set to DEFAULT_FACTORY to use Num_T default constructors only)

## Friends

Vec< Num_T > | operator+ (const Vec< Num_T > &v1, const Vec< Num_T > &v2)
| Addition of two vectors.
Vec< Num_T > | operator+ (const Vec< Num_T > &v, Num_T t)
| Addition of a vector and a scalar.
Vec< Num_T > | operator+ (Num_T t, const Vec< Num_T > &v)
| Addition of a scalar and a vector.
Vec< Num_T > | operator- (const Vec< Num_T > &v1, const Vec< Num_T > &v2)
| Subtraction of `v2` from `v1`.
Vec< Num_T > | operator- (const Vec< Num_T > &v, Num_T t)
| Subtraction of scalar from vector.
Vec< Num_T > | operator- (Num_T t, const Vec< Num_T > &v)
| Subtraction of vector from scalar.
Vec< Num_T > | operator- (const Vec< Num_T > &v)
| Negation of vector.
Vec< Num_T > | operator* (const Vec< Num_T > &v, Num_T t)
| Elementwise multiplication of vector and scalar.
Vec< Num_T > | operator* (Num_T t, const Vec< Num_T > &v)
| Elementwise multiplication of vector and scalar.
Vec< Num_T > | elem_mult (const Vec< Num_T > &a, const Vec< Num_T > &b)
| Elementwise multiplication.
Vec< Num_T > | elem_mult (const Vec< Num_T > &a, const Vec< Num_T > &b, const Vec< Num_T > &c)
| Elementwise multiplication of three vectors.
Vec< Num_T > | elem_mult (const Vec< Num_T > &a, const Vec< Num_T > &b, const Vec< Num_T > &c, const Vec< Num_T > &d)
| Elementwise multiplication of four vectors.
void | elem_mult_out (const Vec< Num_T > &a, const Vec< Num_T > &b, Vec< Num_T > &out)
| Elementwise multiplication, storing the result in vector `out`.
void | elem_mult_out (const Vec< Num_T > &a, const Vec< Num_T > &b, const Vec< Num_T > &c, Vec< Num_T > &out)
| Elementwise multiplication of three vectors, storing the result in vector `out`.
void | elem_mult_out (const Vec< Num_T > &a, const Vec< Num_T > &b, const Vec< Num_T > &c, const Vec< Num_T > &d, Vec< Num_T > &out)
| Elementwise multiplication of four vectors, storing the result in vector `out`.
void | elem_mult_inplace (const Vec< Num_T > &a, Vec< Num_T > &b)
| In-place element-wise multiplication of two vectors. Fast version of b = elem_mult(a,b).
Num_T | elem_mult_sum (const Vec< Num_T > &a, const Vec< Num_T > &b)
| Element-wise multiplication of two vectors, followed by summation of the resultant elements. Fast version of sum(elem_mult(a,b))
Vec< Num_T > | operator/ (const Vec< Num_T > &v, Num_T t)
| Elementwise division.
Vec< Num_T > | operator/ (Num_T t, const Vec< Num_T > &v)
| Elementwise division.
Vec< Num_T > | elem_div (const Vec< Num_T > &v1, const Vec< Num_T > &v2)
| Elementwise division.
Vec< Num_T > | elem_div (Num_T t, const Vec< Num_T > &v)
| This function is deprecated. Please use operator/(Num_T, const Vec<Num_T> &) instead.
void | elem_div_out (const Vec< Num_T > &v1, const Vec< Num_T > &v2, Vec< Num_T > &out)
| Elementwise division.
Num_T | elem_div_sum (const Vec< Num_T > &a, const Vec< Num_T > &b)
| Elementwise division, followed by summation of the resultant elements. Fast version of sum(elem_mult(a,b))
Vec< Num_T > | concat (const Vec< Num_T > &v, Num_T t)
| Append element `t` to the end of the vector `v`.
Vec< Num_T > | concat (Num_T t, const Vec< Num_T > &v)
| Insert element `t` at the beginning of the vector `v`.
Vec< Num_T > | concat (const Vec< Num_T > &v1, const Vec< Num_T > &v2)
| Concatenate vectors `v1` and `v2`.
Vec< Num_T > | concat (const Vec< Num_T > &v1, const Vec< Num_T > &v2, const Vec< Num_T > &v3)
| Concatenate vectors `v1`, `v2` and `v3`.
Vec< Num_T > | concat (const Vec< Num_T > &v1, const Vec< Num_T > &v2, const Vec< Num_T > &v3, const Vec< Num_T > &v4)
| Concatenate vectors `v1`, `v2`, `v3` and `v4`.
Vec< Num_T > | concat (const Vec< Num_T > &v1, const Vec< Num_T > &v2, const Vec< Num_T > &v3, const Vec< Num_T > &v4, const Vec< Num_T > &v5)
| Concatenate vectors `v1`, `v2`, `v3`, `v4` and `v5`.

## Related Symbols

(Note that these are not member symbols.)
typedef Vec< double > | vec
| Definition of double vector type.
typedef Vec< std::complex< double > > | cvec
| Definition of complex<double> vector type.
typedef Vec< int > | ivec
| Definition of integer vector type.
typedef Vec< short int > | svec
| Definition of short vector type.
typedef Vec< bin > | bvec
| Definition of binary vector type.
template<class T >
bvec | to_bvec (const Vec< T > &v)
| Converts a Vec<T> to bvec.
template<class T >
svec | to_svec (const Vec< T > &v)
| Converts a Vec<T> to svec.
template<class T >
ivec | to_ivec (const Vec< T > &v)
| Converts a Vec<T> to ivec.
template<class T >
vec | to_vec (const Vec< T > &v)
| Converts a Vec<T> to vec.
template<class T >
cvec | to_cvec (const Vec< T > &v)
| Converts a Vec<T> to cvec.
template<class T >
cvec | to_cvec (const Vec< T > &real, const Vec< T > &imag)
| Converts real and imaginary Vec<T> to cvec.
ivec | to_ivec (int s)
| Converts an int to ivec.
vec | to_vec (double s)
| Converts an double to vec.
cvec | to_cvec (double real, double imag)
| Converts real and imaginary double to cvec.
template<class T >
Vec< T > | repmat (const Vec< T > &v, int n)
| Creates a vector with `n` copies of the vector `v`.
vec | operator+ (const float &s, const vec &v)
| Addition operator for float and vec.
vec | operator+ (const short &s, const vec &v)
| Addition operator for short and vec.
vec | operator+ (const int &s, const vec &v)
| Addition operator for int and vec.
vec | operator+ (const vec &v, const float &s)
| Addition operator for vec and float.
vec | operator+ (const vec &v, const short &s)
| Addition operator for vec and short.
vec | operator+ (const vec &v, const int &s)
| Addition operator for vec and int.
vec | operator- (const float &s, const vec &v)
| Subtraction operator for float and vec.
vec | operator- (const short &s, const vec &v)
| Subtraction operator for short and vec.
vec | operator- (const int &s, const vec &v)
| Subtraction operator for int and vec.
vec | operator- (const vec &v, const float &s)
| Subtraction operator for vec and float.
vec | operator- (const vec &v, const short &s)
| Subtraction operator for vec and short.
vec | operator- (const vec &v, const int &s)
| Subtraction operator for vec and int.
vec | operator* (const float &s, const vec &v)
| Multiplication operator for float and vec.
vec | operator* (const short &s, const vec &v)
| Multiplication operator for short and vec.
vec | operator* (const int &s, const vec &v)
| Multiplication operator for int and vec.
cvec | operator* (const std::complex< double > &s, const vec &v)
| Multiplication operator for complex<double> and vec.
vec | operator* (const vec &v, const float &s)
| Multiplication operator for vec and float.
vec | operator* (const vec &v, const short &s)
| Multiplication operator for vec and short.
vec | operator* (const vec &v, const int &s)
| Multiplication operator for vec and int.
cvec | operator* (const vec &v, const std::complex< double > &s)
| Multiplication operator for vec and complex<double>
vec | operator/ (const vec &v, const float &s)
| Division operator for vec and float.
vec | operator/ (const vec &v, const short &s)
| Division operator for vec and short.
vec | operator/ (const vec &v, const int &s)
| Division operator for vec and int.
ITPP_EXPORT vec | operator+ (const double &s, const ivec &v)
| Addition operator for double and ivec.
vec | operator+ (const ivec &v, const double &s)
| Addition operator for ivec and double.
ITPP_EXPORT vec | operator- (const double &s, const ivec &v)
| Subtraction operator for double and ivec.
vec | operator- (const ivec &v, const double &s)
| Subtraction operator for ivec and double.
ITPP_EXPORT vec | operator* (const double &s, const ivec &v)
| Multiplication operator for double and ivec.
vec | operator* (const ivec &v, const double &s)
| Multiplication operator for ivec and double.
ITPP_EXPORT vec | operator/ (const double &s, const ivec &v)
| Division operator for double and ivec.
ITPP_EXPORT vec | operator/ (const ivec &v, const double &s)
| Division operator for ivec and double.
ITPP_EXPORT cvec | operator+ (const std::complex< double > &s, const ivec &v)
| Addition operator for complex<double> and ivec.
cvec | operator+ (const ivec &v, const std::complex< double > &s)
| Addition operator for ivec and complex<double>
ITPP_EXPORT cvec | operator- (const std::complex< double > &s, const ivec &v)
| Subtraction operator for complex<double> and ivec.
cvec | operator- (const ivec &v, const std::complex< double > &s)
| Subtraction operator for ivec and complex<double>
ITPP_EXPORT cvec | operator* (const std::complex< double > &s, const ivec &v)
| Multiplication operator for complex<double> and ivec.
cvec | operator* (const ivec &v, const std::complex< double > &s)
| Multiplication operator for ivec and complex<double>
ITPP_EXPORT cvec | operator/ (const std::complex< double > &s, const ivec &v)
| Division operator for complex<double> and ivec.
ITPP_EXPORT cvec | operator/ (const ivec &v, const std::complex< double > &s)
| Division operator for ivec and complex<double>
ITPP_EXPORT cvec | operator+ (const double &s, const cvec &v)
| Addition operator for double and cvec.
cvec | operator+ (const float &s, const cvec &v)
| Addition operator for float and cvec.
cvec | operator+ (const short &s, const cvec &v)
| Addition operator for short and cvec.
cvec | operator+ (const int &s, const cvec &v)
| Addition operator for int and cvec.
cvec | operator+ (const cvec &v, const float &s)
| Addition operator for cvec and float.
cvec | operator+ (const cvec &v, const double &s)
| Addition operator for cvec and double.
cvec | operator+ (const cvec &v, const short &s)
| Addition operator for cvec and short.
cvec | operator+ (const cvec &v, const int &s)
| Addition operator for cvec and int.
ITPP_EXPORT cvec | operator- (const double &s, const cvec &v)
| Subtraction operator for double and cvec.
cvec | operator- (const float &s, const cvec &v)
| Subtraction operator for float and cvec.
cvec | operator- (const short &s, const cvec &v)
| Subtraction operator for short and cvec.
cvec | operator- (const int &s, const cvec &v)
| Subtraction operator for int and cvec.
cvec | operator- (const cvec &v, const float &s)
| Subtraction operator for cvec and float.
cvec | operator- (const cvec &v, const double &s)
| Subtraction operator for cvec and double.
cvec | operator- (const cvec &v, const short &s)
| Subtraction operator for cvec and short.
cvec | operator- (const cvec &v, const int &s)
| Subtraction operator for cvec and int.
ITPP_EXPORT cvec | operator* (const double &s, const cvec &v)
| Multiplication operator for double and cvec.
cvec | operator* (const float &s, const cvec &v)
| Multiplication operator for float and cvec.
cvec | operator* (const short &s, const cvec &v)
| Multiplication operator for short and cvec.
cvec | operator* (const int &s, const cvec &v)
| Multiplication operator for int and cvec.
cvec | operator* (const cvec &v, const float &s)
| Multiplication operator for cvec and float.
cvec | operator* (const cvec &v, const double &s)
| Multiplication operator for cvec and double.
cvec | operator* (const cvec &v, const short &s)
| Multiplication operator for cvec and short.
cvec | operator* (const cvec &v, const int &s)
| Multiplication operator for cvec and int.
ITPP_EXPORT cvec | operator/ (const cvec &v, const double &s)
| Division operator for cvec and double.
ITPP_EXPORT cvec | operator/ (const double &s, const cvec &v)
| Division operator for double and cvec.
cvec | operator/ (const cvec &v, const float &s)
| Division operator for cvec and float.
cvec | operator/ (const cvec &v, const short &s)
| Division operator for cvec and short.
cvec | operator/ (const cvec &v, const int &s)
| Division operator for cvec and int.
ITPP_EXPORT vec | operator+ (const bvec &a, const vec &b)
| Addition operator for bvec and vec.
ITPP_EXPORT vec | operator+ (const svec &a, const vec &b)
| Addition operator for svec and vec.
ITPP_EXPORT vec | operator+ (const ivec &a, const vec &b)
| Addition operator for ivec and vec.
vec | operator+ (const vec &a, const bvec &b)
| Addition operator for vec and bvec.
vec | operator+ (const vec &a, const svec &b)
| Addition operator for vec and svec.
vec | operator+ (const vec &a, const ivec &b)
| Addition operator for vec and ivec.
vec | operator- (const bvec &a, const vec &b)
| Subtraction operator for bvec and vec.
vec | operator- (const svec &a, const vec &b)
| Subtraction operator for svec and vec.
vec | operator- (const ivec &a, const vec &b)
| Subtraction operator for ivec and vec.
vec | operator- (const vec &a, const bvec &b)
| Subtraction operator for vec and bvec.
vec | operator- (const vec &a, const svec &b)
| Subtraction operator for vec and svec.
vec | operator- (const vec &a, const ivec &b)
| Subtraction operator for vec and ivec.
ITPP_EXPORT double | operator* (const bvec &a, const vec &b)
| Multiplication operator for bvec and vec.
ITPP_EXPORT double | operator* (const svec &a, const vec &b)
| Multiplication operator for svec and vec.
ITPP_EXPORT double | operator* (const ivec &a, const vec &b)
| Multiplication operator for ivec and vec.
double | operator* (const vec &a, const bvec &b)
| Multiplication operator for vec and bvec.
double | operator* (const vec &a, const svec &b)
| Multiplication operator for vec and svec.
double | operator* (const vec &a, const ivec &b)
| Multiplication operator for vec and ivec.
ITPP_EXPORT cvec | operator+ (const bvec &a, const cvec &b)
| Addition operator for bvec and cvec.
ITPP_EXPORT cvec | operator+ (const svec &a, const cvec &b)
| Addition operator for svec and cvec.
ITPP_EXPORT cvec | operator+ (const ivec &a, const cvec &b)
| Addition operator for ivec and cvec.
cvec | operator+ (const cvec &a, const bvec &b)
| Addition operator for cvec and bvec.
cvec | operator+ (const cvec &a, const svec &b)
| Addition operator for cvec and svec.
cvec | operator+ (const cvec &a, const ivec &b)
| Addition operator for cvec and ivec.
cvec | operator- (const bvec &a, const cvec &b)
| Subtraction operator for bvec and cvec.
cvec | operator- (const svec &a, const cvec &b)
| Subtraction operator for svec and cvec.
cvec | operator- (const ivec &a, const cvec &b)
| Subtraction operator for ivec and cvec.
cvec | operator- (const cvec &a, const bvec &b)
| Subtraction operator for cvec and bvec.
cvec | operator- (const cvec &a, const svec &b)
| Subtraction operator for cvec and svec.
cvec | operator- (const cvec &a, const ivec &b)
| Subtraction operator for cvec and ivec.
ITPP_EXPORT std::complex< double > | operator* (const bvec &a, const cvec &b)
| Multiplication operator for bvec and cvec.
ITPP_EXPORT std::complex< double > | operator* (const svec &a, const cvec &b)
| Multiplication operator for svec and cvec.
ITPP_EXPORT std::complex< double > | operator* (const ivec &a, const cvec &b)
| Multiplication operator for ivec and cvec.
std::complex< double > | operator* (const cvec &a, const bvec &b)
| Multiplication operator for cvec and bvec.
std::complex< double > | operator* (const cvec &a, const svec &b)
| Multiplication operator for cvec and svec.
std::complex< double > | operator* (const cvec &a, const ivec &b)
| Multiplication operator for cvec and ivec.
template<class T >
void | sort (Vec< T > &data, SORTING_METHOD method=INTROSORT)
| Sort the data vector in increasing order.
template<class T >
ivec | sort_index (const Vec< T > &data, SORTING_METHOD method=INTROSORT)
| Return an index vector corresponding to a sorted vector data in increasing order.
template<class T >
Vec< T > | vec_1 (T v0)
| Vector of length 1.
template<class T >
Vec< T > | vec_2 (T v0, T v1)
| Vector of length 2.
template<class T >
Vec< T > | vec_3 (T v0, T v1, T v2)
| Vector of length 3.

## Detailed Description

template<class Num_T>
class itpp::Vec< Num_T >

Vector Class (Templated)

Author
  Tony Ottosson, Tobias Ringstrom, Adam Piatyszek and Conrad Sanderson

Vectors can be of arbitrary types, but conversions and functions are prepared for `bin`, `short`, `int`, `double`, and `complex<double>` vectors and these are predefined as: `bvec`, `svec`, `ivec`, `vec`, and `cvec`. `double` and `complex<double>` are `double` and `complex<double>` respectively.

Examples:

Vector Constructors: When constructing a vector without a length (memory) use

vec temp;
itpp::Array
General array class.
Definition array.h:105
itpp::Vec< double >

For construction of a vector of a given length use

vec temp(length);
itpp::Vec::length
int length() const
The size of the vector.
Definition vec.h:269

It is also possible to assign the constructed vector the value and size of another vector by

vec temp(invector);

If you have explicit values you would like to assign to the vector it is possible to do this using strings as:

vec a("0 0.7 5 9.3"); // that is a = [0, 0.7, 5, 9.3]
vec a="0 0.7 5 9.3"; // the constructor is called implicitly
ivec b="0:5"; // that is, b = [0, 1, 2, 3, 4, 5]
vec c="3:2.5:13"; // that is, c = [3, 5.5, 8, 10.5, 13]

It is also possible to change length by

temp.set_size(new_length, false);
itpp::Array::set_size
void set_size(int n, bool copy=false)
Resizing an Array<T>.
Definition array.h:257

where `false` is used to indicate that the old values in `temp` are not copied. If you would like to preserve the values, use `true`.

There are a number of methods to access parts of a vector. Examples are

a(5); // Element number 5
a(5,9); // Elements 5, 6, 7, 8, and 9
a.left(10); // The 10 leftmost elements (the first)
a.right(10); // The 10 rightmost elements (the last)
a.mid(5, 7); // 7 elements starting from element 5
itpp::Array::mid
Array< T > mid(int pos, int n) const
Get n elements of the array starting from pos.
Definition array.h:377
itpp::Array::left
Array< T > left(int n) const
Get n left elements of the array.
Definition array.h:357
itpp::Array::right
Array< T > right(int n) const
Get n right elements of the array.
Definition array.h:367

It is also possible to modify parts of a vector, as in e.g.

a.del(5); // deletes element number 5
a.ins(3.4, 9); // inserts the element 3.4 at position 9
a.set_subvector(12, b); // replaces elements from 12 with the vector b

It is, of course, also possible to perform common linear algebra operations, such as addition, subtraction, and scalar product (*). Observe though, that vectors are assumed to be column-vectors in operations with matrices.

Most elementary functions such as sin(), cosh(), log(), abs(), ..., are also available as operations on the individual elements of the vectors. Please see the individual functions for more details.

By default, the Vec elements are created using the default constructor for the element type. This can be changed by specifying a suitable Factory in the Vec constructor call; see Detailed Description for Factory.

Definition at line 244 of file vec.h.

## Member Typedef Documentation

## value_type

template<class Num_T >

typedef Num_T itpp::Vec< Num_T >::value_type

The type of the vector values.

Definition at line 248 of file vec.h.

## Constructor & Destructor Documentation

## Vec() [1/7]

template<class Num_T >

itpp::Vec< Num_T >::Vec | ( | const Factory & | f = `DEFAULT_FACTORY` | ) |

inline explicit

Default constructor. An element factory `f` can be specified.

Definition at line 614 of file vec.h.

## Vec() [2/7]

template<class Num_T >

itpp::Vec< Num_T >::Vec | ( | int | size,
|  | const Factory & | f = `DEFAULT_FACTORY`
| ) |  |

inline explicit

Constructor with size parameter. An element factory `f` can be specified.

Definition at line 617 of file vec.h.

References itpp::Vec< Num_T >::alloc(), it_assert_debug, and itpp::Vec< Num_T >::size().

## Vec() [3/7]

template<class Num_T >

itpp::Vec< Num_T >::Vec | ( | const Vec< Num_T > & | v | ) |

inline

Copy constructor.

Definition at line 624 of file vec.h.

References itpp::Vec< Num_T >::alloc(), itpp::Array< T >::data, itpp::Vec< Num_T >::data, and itpp::Vec< Num_T >::datasize.

## Vec() [4/7]

template<class Num_T >

itpp::Vec< Num_T >::Vec | ( | const Vec< Num_T > & | v,
|  | const Factory & | f
| ) |  |

inline

Copy constructor, which takes an element factory `f` as an additional argument.

Definition at line 631 of file vec.h.

References itpp::Vec< Num_T >::alloc(), itpp::Array< T >::data, itpp::Vec< Num_T >::data, and itpp::Vec< Num_T >::datasize.

## Vec() [5/7]

template<class Num_T >

itpp::Vec< Num_T >::Vec | ( | const char * | str,
|  | const Factory & | f = `DEFAULT_FACTORY`
| ) |  |

inline

Constructor taking a char string as input. An element factory `f` can be specified.

Definition at line 638 of file vec.h.

References itpp::Vec< Num_T >::set().

## Vec() [6/7]

template<class Num_T >

itpp::Vec< Num_T >::Vec | ( | const std::string & | str,
|  | const Factory & | f = `DEFAULT_FACTORY`
| ) |  |

inline

Constructor taking a string as input. An element factory `f` can be specified.

Definition at line 644 of file vec.h.

References itpp::Vec< Num_T >::set().

## Vec() [7/7]

template<class Num_T >

itpp::Vec< Num_T >::Vec | ( | const Num_T * | c_array,
|  | int | size,
|  | const Factory & | f = `DEFAULT_FACTORY`
| ) |  |

inline

Constructor taking a C-array as input. Copies all data. An element factory `f` can be specified.

Definition at line 650 of file vec.h.

References itpp::Vec< Num_T >::alloc(), itpp::Vec< Num_T >::data, and itpp::Vec< Num_T >::size().

## ~Vec()

template<class Num_T >

itpp::Vec< Num_T >::~Vec | ( |  | ) |

inline

Destructor.

Definition at line 657 of file vec.h.

References itpp::Array< T >::free().

## Member Function Documentation

## length()

template<class Num_T >

int itpp::Vec< Num_T >::length | ( |  | ) | const

inline

The size of the vector.

Definition at line 269 of file vec.h.

References itpp::Vec< Num_T >::datasize.

## size()

template<class Num_T >

int itpp::Vec< Num_T >::size | ( |  | ) | const

inline

The size of the vector.

Definition at line 271 of file vec.h.

References itpp::Vec< Num_T >::datasize.

Referenced by itpp::lshift_fix(), itpp::lshift_fix(), itpp::Vec< Num_T >::operator*(), itpp::Vec< Num_T >::operator*(), itpp::operator*(), itpp::Vec< Num_T >::operator*(), itpp::Vec< Num_T >::operator*(), itpp::Vec< Num_T >::operator*(), itpp::Vec< Num_T >::operator*(), itpp::Vec< Num_T >::operator+(), itpp::Vec< Num_T >::operator+(), itpp::operator+(), itpp::Vec< Num_T >::operator+(), itpp::Vec< Num_T >::operator+(), itpp::Vec< Num_T >::operator+(), itpp::Vec< Num_T >::operator+(), itpp::rshift_fix(), itpp::rshift_fix(), itpp::rshift_fix(), itpp::rshift_fix(), itpp::set_fix(), itpp::set_fix(), itpp::set_fix(), itpp::set_fix(), itpp::set_fix(), itpp::set_fix(), itpp::Vec< Num_T >::set_length(), itpp::Vec< Num_T >::Vec(), and itpp::Vec< Num_T >::Vec().

## set_size()

template<class Num_T >

void itpp::Vec< Num_T >::set_size | ( | int | size,
|  | bool | copy = `false`
| ) |  |

Set length of vector. if copy = true then keeping the old values.

Definition at line 663 of file vec.h.

References itpp::Array< T >::alloc(), itpp::Array< T >::data, itpp::destroy_elements(), itpp::Array< T >::free(), it_assert_debug, itpp::min(), and itpp::Array< T >::size().

Referenced by itpp::set_fix(), itpp::set_fix(), itpp::set_fix(), itpp::set_fix(), itpp::set_fix(), itpp::set_fix(), itpp::Vec< Num_T >::set_length(), itpp::QAM::set_M(), itpp::PSK::set_M(), itpp::PAM_c::set_M(), and itpp::PAM::set_M().

## set_length()

template<class Num_T >

void itpp::Vec< Num_T >::set_length | ( | int | size,
|  | bool | copy = `false`
| ) |  |

inline

Set length of vector. if copy = true then keeping the old values.

Definition at line 276 of file vec.h.

References itpp::Vec< Num_T >::set_size(), and itpp::Vec< Num_T >::size().

## zeros()

template<class Num_T >

void itpp::Vec< Num_T >::zeros | ( |  | ) |

inline

Set the vector to the all zero vector.

Definition at line 786 of file vec.h.

References itpp::Array< T >::data.

Referenced by itpp::Vec< Num_T >::clear().

## clear()

template<class Num_T >

void itpp::Vec< Num_T >::clear | ( |  | ) |

inline

Set the vector to the all zero vector.

Definition at line 280 of file vec.h.

References itpp::Vec< Num_T >::zeros().

Referenced by itpp::MA_Filter< T1, T2, T3 >::clear(), itpp::AR_Filter< T1, T2, T3 >::clear(), and itpp::ARMA_Filter< T1, T2, T3 >::clear().

## ones()

template<class Num_T >

void itpp::Vec< Num_T >::ones | ( |  | ) |

inline

Set the vector to the all one vector.

Definition at line 793 of file vec.h.

References itpp::Array< T >::data.

## set() [1/2]

template<class Num_T >

void itpp::Vec< Num_T >::set | ( | const std::string & | str | ) |

inline

Set the vector equal to the values in the `str` string.

Definition at line 807 of file vec.h.

References it_error.

## operator[]() [1/2]

template<class Num_T >

const Num_T & itpp::Vec< Num_T >::operator[] | ( | int | i | ) | const

inline

C-style index operator. First element is 0.

Definition at line 692 of file vec.h.

References itpp::Array< T >::data, itpp::Array< T >::in_range(), and it_assert_debug.

## operator()() [1/5]

template<class Num_T >

const Num_T & itpp::Vec< Num_T >::operator() | ( | int | i | ) | const

inline

Index operator. First element is 0.

Definition at line 699 of file vec.h.

## operator[]() [2/2]

template<class Num_T >

Num_T & itpp::Vec< Num_T >::operator[] | ( | int | i | ) |

inline

C-style index operator. First element is 0.

Definition at line 705 of file vec.h.

References itpp::Array< T >::data, itpp::Array< T >::in_range(), and it_assert_debug.

## operator()() [2/5]

template<class Num_T >

Num_T & itpp::Vec< Num_T >::operator() | ( | int | i | ) |

inline

Index operator. First element is 0.

Definition at line 712 of file vec.h.

## operator()() [3/5]

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::operator() | ( | int | i1,
|  | int | i2
| ) |  | const

inline

Sub-vector with elements from `i1` to `i2`. Index -1 indicates the last element.

Definition at line 718 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## operator()() [4/5]

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::operator() | ( | const Vec< int > & | indexlist | ) | const

Sub-vector with elements given by the list of indices `indexlist`.

Definition at line 733 of file vec.h.

References itpp::Array< T >::data, itpp::Array< T >::in_range(), it_assert_debug, and itpp::Array< T >::size().

## operator()() [5/5]

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::operator() | ( | const Vec< bin > & | binlist | ) | const

Sub-vector with elements with indexes where `binlist` is `1`.

Definition at line 746 of file vec.h.

References itpp::Array< T >::data, it_assert_debug, itpp::Array< T >::set_size(), and itpp::Array< T >::size().

## get() [1/4]

template<class Num_T >

const Num_T & itpp::Vec< Num_T >::get | ( | int | i | ) | const

inline

Accessor-style method. First element is 0.

Definition at line 762 of file vec.h.

## get() [2/4]

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::get | ( | int | i1,
|  | int | i2
| ) |  | const

inline

Get the elements from `i1` to `i2`. Index -1 indicates the last element.

Definition at line 768 of file vec.h.

## get() [3/4]

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::get | ( | const Vec< int > & | indexlist | ) | const

inline

Get the elements given by the list of indices `indexlist`.

Definition at line 774 of file vec.h.

## get() [4/4]

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::get | ( | const Vec< bin > & | binlist | ) | const

inline

Get the elements with indexes where `binlist` is `1`.

Definition at line 780 of file vec.h.

## set() [2/2]

template<class Num_T >

void itpp::Vec< Num_T >::set | ( | int | i,
|  | Num_T | t
| ) |  |

inline

Modifier-style method. First element is 0.

Definition at line 800 of file vec.h.

References itpp::Array< T >::data, itpp::Array< T >::in_range(), and it_assert_debug.

## transpose()

template<class Num_T >

Mat< Num_T > itpp::Vec< Num_T >::transpose | ( |  | ) | const

Matrix transpose. Converts to a matrix with the vector in the first row.

Definition at line 833 of file vec.h.

References itpp::Array< T >::data.

Referenced by itpp::Vec< Num_T >::T().

## T()

template<class Num_T >

Mat< Num_T > itpp::Vec< Num_T >::T | ( |  | ) | const

inline

Matrix transpose. Converts to a matrix with the vector in the first row.

Definition at line 318 of file vec.h.

References itpp::Vec< Num_T >::transpose().

## hermitian_transpose()

template<class Num_T >

Mat< Num_T > itpp::Vec< Num_T >::hermitian_transpose | ( |  | ) | const

Hermitian matrix transpose. Converts to a matrix with the conjugate of the vector in the first row.

Definition at line 841 of file vec.h.

References itpp::Array< T >::data.

Referenced by itpp::Vec< Num_T >::H().

## H()

template<class Num_T >

Mat< Num_T > itpp::Vec< Num_T >::H | ( |  | ) | const

inline

Hermitian matrix transpose. Converts to a matrix with the conjugate of the vector in the first row.

Definition at line 322 of file vec.h.

References itpp::Vec< Num_T >::hermitian_transpose().

## operator+=() [1/2]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator+= | ( | const Vec< Num_T > & | v | ) |

Addition of vector.

Definition at line 855 of file vec.h.

References itpp::Array< T >::alloc(), itpp::Array< T >::data, and it_assert_debug.

## operator+=() [2/2]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator+= | ( | Num_T | t | ) |

inline

Addition of scalar.

Definition at line 872 of file vec.h.

References itpp::Array< T >::data.

## operator-=() [1/2]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator-= | ( | const Vec< Num_T > & | v | ) |

Subtraction of vector.

Definition at line 917 of file vec.h.

References itpp::Array< T >::alloc(), itpp::Array< T >::data, and it_assert_debug.

## operator-=() [2/2]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator-= | ( | Num_T | t | ) |

inline

Subtraction of scalar.

Definition at line 935 of file vec.h.

References itpp::Array< T >::data.

## operator*=()

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator*= | ( | Num_T | t | ) |

inline

Multiply with a scalar.

Definition at line 992 of file vec.h.

References itpp::Array< T >::data.

## operator/=() [1/2]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator/= | ( | Num_T | t | ) |

inline

Elementwise division.

Definition at line 1177 of file vec.h.

References itpp::Array< T >::data.

## operator/=() [2/2]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator/= | ( | const Vec< Num_T > & | v | ) |

inline

Elementwise division.

Definition at line 1186 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## right()

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::right | ( | int | nr | ) | const

Get the right `nr` elements from the vector.

Definition at line 1228 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

Referenced by itpp::chebwin().

## left()

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::left | ( | int | nr | ) | const

Get the left `nr` elements from the vector.

Definition at line 1239 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## mid()

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::mid | ( | int | start,
|  | int | nr
| ) |  | const

Get the middle part of vector from `start` including `nr` elements.

Definition at line 1250 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## split()

template<class Num_T >

Vec< Num_T > itpp::Vec< Num_T >::split | ( | int | pos | ) |

Split the vector into two parts at element `pos`.

Return the first part containing elements 0 to `pos-1`, and keep the second part containing the remaining elements starting from `pos` (empty vector if `pos` is equal to the length of the vector).

Definition at line 1262 of file vec.h.

References itpp::Array< T >::data, it_assert_debug, and itpp::Array< T >::set_size().

## shift_right() [1/2]

template<class Num_T >

void itpp::Vec< Num_T >::shift_right | ( | Num_T | t,
|  | int | n = `1`
| ) |  |

Shift in element `t` at position 0 `n` times.

Definition at line 1282 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## shift_right() [2/2]

template<class Num_T >

void itpp::Vec< Num_T >::shift_right | ( | const Vec< Num_T > & | v | ) |

Shift in vector `v` at position 0.

Definition at line 1294 of file vec.h.

References itpp::Array< T >::data.

## shift_left() [1/2]

template<class Num_T >

void itpp::Vec< Num_T >::shift_left | ( | Num_T | t,
|  | int | n = `1`
| ) |  |

Shift out the `n` left elements and at the same time shift in the element `t` at last position `n` times.

Definition at line 1303 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## shift_left() [2/2]

template<class Num_T >

void itpp::Vec< Num_T >::shift_left | ( | const Vec< Num_T > & | v | ) |

Shift in vector `v` at last positions.

Definition at line 1315 of file vec.h.

References itpp::Array< T >::data.

## set_subvector() [1/3]

template<class Num_T >

void itpp::Vec< Num_T >::set_subvector | ( | int | i1,
|  | int | i2,
|  | const Vec< Num_T > & | v
| ) |  |

This function is deprecated. Please use set_subvector(i, v) instead.

Definition at line 1404 of file vec.h.

References it_warning.

## set_subvector() [2/3]

template<class Num_T >

void itpp::Vec< Num_T >::set_subvector | ( | int | i,
|  | const Vec< Num_T > & | v
| ) |  |

inline

Set subvector to elements of vector `v` starting from element `i`.

Definition at line 1413 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## set_subvector() [3/3]

template<class Num_T >

void itpp::Vec< Num_T >::set_subvector | ( | int | i1,
|  | int | i2,
|  | Num_T | t
| ) |  |

inline

Set subvector defined by indices `i1` and `i2` to `t`.

Definition at line 1422 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## replace_mid()

template<class Num_T >

void itpp::Vec< Num_T >::replace_mid | ( | int | i,
|  | const Vec< Num_T > & | v
| ) |  |

inline

An alias function of set_subvector(i, &v)

Definition at line 1434 of file vec.h.

## del() [1/2]

template<class Num_T >

void itpp::Vec< Num_T >::del | ( | int | i | ) |

Delete element number `i`.

Definition at line 1440 of file vec.h.

References itpp::Array< T >::data, itpp::Array< T >::in_range(), it_assert_debug, and itpp::Array< T >::set_size().

## del() [2/2]

template<class Num_T >

void itpp::Vec< Num_T >::del | ( | int | i1,
|  | int | i2
| ) |  |

Delete elements from `i1` to `i2`.

Definition at line 1450 of file vec.h.

References itpp::Array< T >::data, it_assert_debug, and itpp::Array< T >::set_size().

## ins() [1/2]

template<class Num_T >

void itpp::Vec< Num_T >::ins | ( | int | i,
|  | Num_T | t
| ) |  |

Insert element `t` before element with index `i` (0 <= i <= datasize)

Definition at line 1464 of file vec.h.

References itpp::Array< T >::data, it_assert_debug, and itpp::Array< T >::set_size().

## ins() [2/2]

template<class Num_T >

void itpp::Vec< Num_T >::ins | ( | int | i,
|  | const Vec< Num_T > & | v
| ) |  |

Insert vector `v` before element with index `i` (0 <= i <= datasize)

Definition at line 1477 of file vec.h.

References itpp::Array< T >::data, it_assert_debug, itpp::Array< T >::length(), itpp::Array< T >::set_size(), and itpp::Array< T >::size().

## operator=() [1/5]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator= | ( | Num_T | t | ) |

inline

Assign all elements in vector to `t`.

Definition at line 1490 of file vec.h.

References itpp::Array< T >::data.

## operator=() [2/5]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator= | ( | const Vec< Num_T > & | v | ) |

inline

Assign vector the value and length of `v`.

Definition at line 1498 of file vec.h.

References itpp::Array< T >::data, and itpp::Array< T >::set_size().

## operator=() [3/5]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator= | ( | const Mat< Num_T > & | m | ) |

Assign vector equal to the 1-dimensional matrix `m`.

Definition at line 1508 of file vec.h.

References itpp::Array< T >::data, it_error, and itpp::Array< T >::set_size().

## operator=() [4/5]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator= | ( | const char * | str | ) |

inline

Assign vector the values in the string `str`.

Definition at line 1524 of file vec.h.

## operator=() [5/5]

template<class Num_T >

Vec< Num_T > & itpp::Vec< Num_T >::operator= | ( | const std::string & | str | ) |

inline

Assign vector the values in the string `str`.

Definition at line 1531 of file vec.h.

## operator==() [1/2]

template<class Num_T >

bvec itpp::Vec< Num_T >::operator== | ( | Num_T | t | ) | const

Elementwise equal to the scalar `t`.

Definition at line 1538 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## operator!=() [1/2]

template<class Num_T >

bvec itpp::Vec< Num_T >::operator!= | ( | Num_T | t | ) | const

Elementwise not-equal to the scalar `t`.

Definition at line 1548 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## operator<()

template<class Num_T >

bvec itpp::Vec< Num_T >::operator< | ( | Num_T | t | ) | const

Elementwise less than the scalar `t`.

Definition at line 1563 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## operator<=()

template<class Num_T >

bvec itpp::Vec< Num_T >::operator<= | ( | Num_T | t | ) | const

Elementwise less than and equal to the scalar `t`.

Definition at line 1573 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## operator>()

template<class Num_T >

bvec itpp::Vec< Num_T >::operator> | ( | Num_T | t | ) | const

Elementwise greater than the scalar `t`.

Definition at line 1588 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## operator>=()

template<class Num_T >

bvec itpp::Vec< Num_T >::operator>= | ( | Num_T | t | ) | const

Elementwise greater than and equal to the scalar `t`.

Definition at line 1603 of file vec.h.

References itpp::Array< T >::data, and it_assert_debug.

## operator==() [2/2]

template<class Num_T >

bool itpp::Vec< Num_T >::operator== | ( | const Vec< Num_T > & | v | ) | const

Compare with vector `v`. Return false if sizes or values differ.

Definition at line 1618 of file vec.h.

References itpp::Array< T >::data.

## operator!=() [2/2]

template<class Num_T >

bool itpp::Vec< Num_T >::operator!= | ( | const Vec< Num_T > & | v | ) | const

Compare with vector `v`. Return true if sizes or values differ.

Definition at line 1629 of file vec.h.

References itpp::Array< T >::data.

## _elem() [1/2]

template<class Num_T >

Num_T & itpp::Vec< Num_T >::_elem | ( | int | i | ) |

inline

Index operator without boundary check. Not recommended for use.

Definition at line 487 of file vec.h.

References itpp::Vec< Num_T >::data.

## _elem() [2/2]

template<class Num_T >

const Num_T & itpp::Vec< Num_T >::_elem | ( | int | i | ) | const

inline

Index operator without boundary check. Not recommended for use.

Definition at line 489 of file vec.h.

References itpp::Vec< Num_T >::data.

## _data() [1/2]

template<class Num_T >

Num_T * itpp::Vec< Num_T >::_data | ( |  | ) |

inline

Get the pointer to the internal structure. Not recommended for use.

Definition at line 492 of file vec.h.

References itpp::Vec< Num_T >::data.

## _data() [2/2]

template<class Num_T >

const Num_T * itpp::Vec< Num_T >::_data | ( |  | ) | const

inline

Get the pointer to the internal structure. Not recommended for use.

Definition at line 494 of file vec.h.

References itpp::Vec< Num_T >::data.

## alloc()

template<class Num_T >

void itpp::Vec< Num_T >::alloc | ( | int | size | ) |

inline protected

Allocate storage for a vector of length `size`.

Definition at line 593 of file vec.h.

References itpp::create_elements(), itpp::Array< T >::data, itpp::Array< T >::factory, and itpp::Array< T >::size().

Referenced by itpp::Vec< Num_T >::Vec(), itpp::Vec< Num_T >::Vec(), itpp::Vec< Num_T >::Vec(), and itpp::Vec< Num_T >::Vec().

## free()

template<class Num_T >

void itpp::Vec< Num_T >::free | ( |  | ) |

inline protected

Free the storage space allocated by the vector.

Definition at line 606 of file vec.h.

References itpp::Array< T >::data, and itpp::destroy_elements().

## Friends And Related Symbol Documentation

## vec

template<class Num_T >

typedef Vec<double> vec

related

Definition of double vector type.

Definition at line 529 of file vec.h.

## cvec

template<class Num_T >

typedef Vec<std::complex<double> > cvec

related

Definition of complex<double> vector type.

Definition at line 535 of file vec.h.

## ivec

template<class Num_T >

typedef Vec<int> ivec

related

Definition of integer vector type.

Definition at line 541 of file vec.h.

## svec

template<class Num_T >

typedef Vec<short int> svec

related

Definition of short vector type.

Definition at line 547 of file vec.h.

## bvec

template<class Num_T >

typedef Vec<bin> bvec

related

Definition of binary vector type.

Definition at line 553 of file vec.h.

## operator+ [1/33]

template<class Num_T >

Vec< Num_T > operator+ | ( | const Vec< Num_T > & | v1,
|  | const Vec< Num_T > & | v2
| ) |  |

friend

Addition of two vectors.

Definition at line 880 of file vec.h.

## operator+ [2/33]

template<class Num_T >

Vec< Num_T > operator+ | ( | const Vec< Num_T > & | v,
|  | Num_T | t
| ) |  |

friend

Addition of a vector and a scalar.

Definition at line 893 of file vec.h.

## operator+ [3/33]

template<class Num_T >

Vec< Num_T > operator+ | ( | Num_T | t,
|  | const Vec< Num_T > & | v
| ) |  |

friend

Addition of a scalar and a vector.

Definition at line 905 of file vec.h.

## operator- [1/34]

template<class Num_T >

Vec< Num_T > operator- | ( | const Vec< Num_T > & | v1,
|  | const Vec< Num_T > & | v2
| ) |  |

friend

Subtraction of `v2` from `v1`.

Definition at line 943 of file vec.h.

## operator- [2/34]

template<class Num_T >

Vec< Num_T > operator- | ( | const Vec< Num_T > & | v,
|  | Num_T | t
| ) |  |

friend

Subtraction of scalar from vector.

Definition at line 956 of file vec.h.

## operator- [3/34]

template<class Num_T >

Vec< Num_T > operator- | ( | Num_T | t,
|  | const Vec< Num_T > & | v
| ) |  |

friend

Subtraction of vector from scalar.

Definition at line 968 of file vec.h.

## operator- [4/34]

template<class Num_T >

Vec< Num_T > operator- | ( | const Vec< Num_T > & | v | ) |

friend

Negation of vector.

Definition at line 980 of file vec.h.

## operator* [1/34]

template<class Num_T >

Vec< Num_T > operator* | ( | const Vec< Num_T > & | v,
|  | Num_T | t
| ) |  |

friend

Elementwise multiplication of vector and scalar.

Definition at line 1044 of file vec.h.

## operator* [2/34]

template<class Num_T >

Vec< Num_T > operator* | ( | Num_T | t,
|  | const Vec< Num_T > & | v
| ) |  |

friend

Elementwise multiplication of vector and scalar.

Definition at line 1055 of file vec.h.

## elem_mult [1/3]

template<class Num_T >

Vec< Num_T > elem_mult | ( | const Vec< Num_T > & | a,
|  | const Vec< Num_T > & | b
| ) |  |

friend

Elementwise multiplication.

Definition at line 1061 of file vec.h.

## elem_mult [2/3]

template<class Num_T >

Vec< Num_T > elem_mult | ( | const Vec< Num_T > & | a,
|  | const Vec< Num_T > & | b,
|  | const Vec< Num_T > & | c
| ) |  |

friend

Elementwise multiplication of three vectors.

Definition at line 1069 of file vec.h.

## elem_mult [3/3]

template<class Num_T >

Vec< Num_T > elem_mult | ( | const Vec< Num_T > & | a,
|  | const Vec< Num_T > & | b,
|  | const Vec< Num_T > & | c,
|  | const Vec< Num_T > & | d
| ) |  |

friend

Elementwise multiplication of four vectors.

Definition at line 1078 of file vec.h.

## elem_mult_out [1/3]

template<class Num_T >

void elem_mult_out | ( | const Vec< Num_T > & | a,
|  | const Vec< Num_T > & | b,
|  | Vec< Num_T > & | out
| ) |  |

friend

Elementwise multiplication, storing the result in vector `out`.

Definition at line 1087 of file vec.h.

## elem_mult_out [2/3]

template<class Num_T >

void elem_mult_out | ( | const Vec< Num_T > & | a,
|  | const Vec< Num_T > & | b,
|  | const Vec< Num_T > & | c,
|  | Vec< Num_T > & | out
| ) |  |

friend

Elementwise multiplication of three vectors, storing the result in vector `out`.

Definition at line 1097 of file vec.h.

## elem_mult_out [3/3]

template<class Num_T >

void elem_mult_out | ( | const Vec< Num_T > & | a,
|  | const Vec< Num_T > & | b,
|  | const Vec< Num_T > & | c,
|  | const Vec< Num_T > & | d,
|  | Vec< Num_T > & | out
| ) |  |

friend

Elementwise multiplication of four vectors, storing the result in vector `out`.

Definition at line 1108 of file vec.h.

## elem_mult_inplace

template<class Num_T >

void elem_mult_inplace | ( | const Vec< Num_T > & | a,
|  | Vec< Num_T > & | b
| ) |  |

friend

In-place element-wise multiplication of two vectors. Fast version of b = elem_mult(a,b).

Definition at line 1123 of file vec.h.

## elem_mult_sum

template<class Num_T >

Num_T elem_mult_sum | ( | const Vec< Num_T > & | a,
|  | const Vec< Num_T > & | b
| ) |  |

friend

Element-wise multiplication of two vectors, followed by summation of the resultant elements. Fast version of sum(elem_mult(a,b))

Definition at line 1132 of file vec.h.

## operator/ [1/14]

template<class Num_T >

Vec< Num_T > operator/ | ( | const Vec< Num_T > & | v,
|  | Num_T | t
| ) |  |

friend

Elementwise division.

Definition at line 1143 of file vec.h.

## operator/ [2/14]

template<class Num_T >

Vec< Num_T > operator/ | ( | Num_T | t,
|  | const Vec< Num_T > & | v
| ) |  |

friend

Elementwise division.

Definition at line 1155 of file vec.h.

## elem_div [1/2]

template<class Num_T >

Vec< Num_T > elem_div | ( | const Vec< Num_T > & | v1,
|  | const Vec< Num_T > & | v2
| ) |  |

friend

Elementwise division.

Definition at line 1196 of file vec.h.

## elem_div [2/2]

template<class Num_T >

Vec< Num_T > elem_div | ( | Num_T | t,
|  | const Vec< Num_T > & | v
| ) |  |

friend

This function is deprecated. Please use operator/(Num_T, const Vec<Num_T> &) instead.

Definition at line 1167 of file vec.h.

## elem_div_out

template<class Num_T >

void elem_div_out | ( | const Vec< Num_T > & | v1,
|  | const Vec< Num_T > & | v2,
|  | Vec< Num_T > & | out
| ) |  |

friend

Elementwise division.

Definition at line 1204 of file vec.h.

## elem_div_sum

template<class Num_T >

Num_T elem_div_sum | ( | const Vec< Num_T > & | a,
|  | const Vec< Num_T > & | b
| ) |  |

friend

Elementwise division, followed by summation of the resultant elements. Fast version of sum(elem_mult(a,b))

Definition at line 1215 of file vec.h.

## concat [1/6]

template<class Num_T >

Vec< Num_T > concat | ( | const Vec< Num_T > & | v,
|  | Num_T | t
| ) |  |

friend

Append element `t` to the end of the vector `v`.

Definition at line 1324 of file vec.h.

## concat [2/6]

template<class Num_T >

Vec< Num_T > concat | ( | Num_T | t,
|  | const Vec< Num_T > & | v
| ) |  |

friend

Insert element `t` at the beginning of the vector `v`.

Definition at line 1334 of file vec.h.

## concat [3/6]

template<class Num_T >

Vec< Num_T > concat | ( | const Vec< Num_T > & | v1,
|  | const Vec< Num_T > & | v2
| ) |  |

friend

Concatenate vectors `v1` and `v2`.

Definition at line 1344 of file vec.h.

## concat [4/6]

template<class Num_T >

Vec< Num_T > concat | ( | const Vec< Num_T > & | v1,
|  | const Vec< Num_T > & | v2,
|  | const Vec< Num_T > & | v3
| ) |  |

friend

Concatenate vectors `v1`, `v2` and `v3`.

Definition at line 1355 of file vec.h.

## concat [5/6]

template<class Num_T >

Vec< Num_T > concat | ( | const Vec< Num_T > & | v1,
|  | const Vec< Num_T > & | v2,
|  | const Vec< Num_T > & | v3,
|  | const Vec< Num_T > & | v4
| ) |  |

friend

Concatenate vectors `v1`, `v2`, `v3` and `v4`.

Definition at line 1369 of file vec.h.

## concat [6/6]

template<class Num_T >

Vec< Num_T > concat | ( | const Vec< Num_T > & | v1,
|  | const Vec< Num_T > & | v2,
|  | const Vec< Num_T > & | v3,
|  | const Vec< Num_T > & | v4,
|  | const Vec< Num_T > & | v5
| ) |  |

friend

Concatenate vectors `v1`, `v2`, `v3`, `v4` and `v5`.

Definition at line 1385 of file vec.h.

## to_bvec()

template<class T >

bvec to_bvec | ( | const Vec< T > & | v | ) |

related

Converts a Vec<T> to bvec.

Definition at line 51 of file converters.h.

References itpp::Array< T >::length().

## to_svec()

template<class T >

svec to_svec | ( | const Vec< T > & | v | ) |

related

Converts a Vec<T> to svec.

Definition at line 65 of file converters.h.

References itpp::Array< T >::length().

## to_ivec()

template<class T >

ivec to_ivec | ( | const Vec< T > & | v | ) |

related

Converts a Vec<T> to ivec.

Definition at line 79 of file converters.h.

References itpp::Array< T >::length().

## to_vec()

template<class T >

vec to_vec | ( | const Vec< T > & | v | ) |

related

Converts a Vec<T> to vec.

Definition at line 93 of file converters.h.

References itpp::Array< T >::length().

## to_cvec() [1/2]

template<class T >

cvec to_cvec | ( | const Vec< T > & | v | ) |

related

Converts a Vec<T> to cvec.

Definition at line 107 of file converters.h.

References itpp::Array< T >::length().

## to_cvec() [2/2]

template<class T >

cvec to_cvec | ( | const Vec< T > & | real,
|  | const Vec< T > & | imag
| ) |  |

related

Converts real and imaginary Vec<T> to cvec.

Definition at line 129 of file converters.h.

References itpp::imag(), it_assert, itpp::Array< T >::length(), and itpp::real().

## operator+() [4/33]

template<class Num_T >

vec operator+ | ( | const float & | s,
|  | const vec & | v
| ) |  |

related

Addition operator for float and vec.

Definition at line 81 of file operators.h.

## operator+() [5/33]

template<class Num_T >

vec operator+ | ( | const short & | s,
|  | const vec & | v
| ) |  |

related

Addition operator for short and vec.

Definition at line 87 of file operators.h.

## operator+() [6/33]

template<class Num_T >

vec operator+ | ( | const int & | s,
|  | const vec & | v
| ) |  |

related

Addition operator for int and vec.

Definition at line 93 of file operators.h.

## operator+() [7/33]

template<class Num_T >

vec operator+ | ( | const vec & | v,
|  | const float & | s
| ) |  |

related

Addition operator for vec and float.

Definition at line 99 of file operators.h.

## operator+() [8/33]

template<class Num_T >

vec operator+ | ( | const vec & | v,
|  | const short & | s
| ) |  |

related

Addition operator for vec and short.

Definition at line 105 of file operators.h.

## operator+() [9/33]

template<class Num_T >

vec operator+ | ( | const vec & | v,
|  | const int & | s
| ) |  |

related

Addition operator for vec and int.

Definition at line 111 of file operators.h.

## operator-() [5/34]

template<class Num_T >

vec operator- | ( | const float & | s,
|  | const vec & | v
| ) |  |

related

Subtraction operator for float and vec.

Definition at line 117 of file operators.h.

## operator-() [6/34]

template<class Num_T >

vec operator- | ( | const short & | s,
|  | const vec & | v
| ) |  |

related

Subtraction operator for short and vec.

Definition at line 123 of file operators.h.

## operator-() [7/34]

template<class Num_T >

vec operator- | ( | const int & | s,
|  | const vec & | v
| ) |  |

related

Subtraction operator for int and vec.

Definition at line 129 of file operators.h.

## operator-() [8/34]

template<class Num_T >

vec operator- | ( | const vec & | v,
|  | const float & | s
| ) |  |

related

Subtraction operator for vec and float.

Definition at line 135 of file operators.h.

## operator-() [9/34]

template<class Num_T >

vec operator- | ( | const vec & | v,
|  | const short & | s
| ) |  |

related

Subtraction operator for vec and short.

Definition at line 141 of file operators.h.

## operator-() [10/34]

template<class Num_T >

vec operator- | ( | const vec & | v,
|  | const int & | s
| ) |  |

related

Subtraction operator for vec and int.

Definition at line 147 of file operators.h.

## operator*() [3/34]

template<class Num_T >

vec operator* | ( | const float & | s,
|  | const vec & | v
| ) |  |

related

Multiplication operator for float and vec.

Definition at line 153 of file operators.h.

## operator*() [4/34]

template<class Num_T >

vec operator* | ( | const short & | s,
|  | const vec & | v
| ) |  |

related

Multiplication operator for short and vec.

Definition at line 159 of file operators.h.

## operator*() [5/34]

template<class Num_T >

vec operator* | ( | const int & | s,
|  | const vec & | v
| ) |  |

related

Multiplication operator for int and vec.

Definition at line 165 of file operators.h.

## operator*() [6/34]

template<class Num_T >

cvec operator* | ( | const std::complex< double > & | s,
|  | const vec & | v
| ) |  |

related

Multiplication operator for complex<double> and vec.

Definition at line 267 of file operators.cpp.

References itpp::Array< T >::size().

## operator*() [7/34]

template<class Num_T >

vec operator* | ( | const vec & | v,
|  | const float & | s
| ) |  |

related

Multiplication operator for vec and float.

Definition at line 177 of file operators.h.

## operator*() [8/34]

template<class Num_T >

vec operator* | ( | const vec & | v,
|  | const short & | s
| ) |  |

related

Multiplication operator for vec and short.

Definition at line 183 of file operators.h.

## operator*() [9/34]

template<class Num_T >

vec operator* | ( | const vec & | v,
|  | const int & | s
| ) |  |

related

Multiplication operator for vec and int.

Definition at line 189 of file operators.h.

## operator*() [10/34]

template<class Num_T >

cvec operator* | ( | const vec & | v,
|  | const std::complex< double > & | s
| ) |  |

related

Multiplication operator for vec and complex<double>

Definition at line 276 of file operators.cpp.

References itpp::Array< T >::size().

## operator/() [3/14]

template<class Num_T >

vec operator/ | ( | const vec & | v,
|  | const float & | s
| ) |  |

related

Division operator for vec and float.

Definition at line 201 of file operators.h.

## operator/() [4/14]

template<class Num_T >

vec operator/ | ( | const vec & | v,
|  | const short & | s
| ) |  |

related

Division operator for vec and short.

Definition at line 207 of file operators.h.

## operator/() [5/14]

template<class Num_T >

vec operator/ | ( | const vec & | v,
|  | const int & | s
| ) |  |

related

Division operator for vec and int.

Definition at line 213 of file operators.h.

## operator+() [10/33]

template<class Num_T >

ITPP_EXPORT vec operator+ | ( | const double & | s,
|  | const ivec & | v
| ) |  |

related

Addition operator for double and ivec.

Definition at line 38 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator+() [11/33]

template<class Num_T >

vec operator+ | ( | const ivec & | v,
|  | const double & | s
| ) |  |

related

Addition operator for ivec and double.

Definition at line 228 of file operators.h.

## operator-() [11/34]

template<class Num_T >

ITPP_EXPORT vec operator- | ( | const double & | s,
|  | const ivec & | v
| ) |  |

related

Subtraction operator for double and ivec.

Definition at line 49 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator-() [12/34]

template<class Num_T >

vec operator- | ( | const ivec & | v,
|  | const double & | s
| ) |  |

related

Subtraction operator for ivec and double.

Definition at line 240 of file operators.h.

## operator*() [11/34]

template<class Num_T >

ITPP_EXPORT vec operator* | ( | const double & | s,
|  | const ivec & | v
| ) |  |

related

Multiplication operator for double and ivec.

Definition at line 60 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator*() [12/34]

template<class Num_T >

vec operator* | ( | const ivec & | v,
|  | const double & | s
| ) |  |

related

Multiplication operator for ivec and double.

Definition at line 252 of file operators.h.

## operator/() [6/14]

template<class Num_T >

ITPP_EXPORT vec operator/ | ( | const double & | s,
|  | const ivec & | v
| ) |  |

related

Division operator for double and ivec.

Definition at line 71 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator/() [7/14]

template<class Num_T >

ITPP_EXPORT vec operator/ | ( | const ivec & | v,
|  | const double & | s
| ) |  |

related

Division operator for ivec and double.

Definition at line 82 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator+() [12/33]

template<class Num_T >

ITPP_EXPORT cvec operator+ | ( | const std::complex< double > & | s,
|  | const ivec & | v
| ) |  |

related

Addition operator for complex<double> and ivec.

Definition at line 93 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator+() [13/33]

template<class Num_T >

cvec operator+ | ( | const ivec & | v,
|  | const std::complex< double > & | s
| ) |  |

related

Addition operator for ivec and complex<double>

Definition at line 276 of file operators.h.

## operator-() [13/34]

template<class Num_T >

ITPP_EXPORT cvec operator- | ( | const std::complex< double > & | s,
|  | const ivec & | v
| ) |  |

related

Subtraction operator for complex<double> and ivec.

Definition at line 104 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator-() [14/34]

template<class Num_T >

cvec operator- | ( | const ivec & | v,
|  | const std::complex< double > & | s
| ) |  |

related

Subtraction operator for ivec and complex<double>

Definition at line 288 of file operators.h.

## operator*() [13/34]

template<class Num_T >

ITPP_EXPORT cvec operator* | ( | const std::complex< double > & | s,
|  | const ivec & | v
| ) |  |

related

Multiplication operator for complex<double> and ivec.

Definition at line 115 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator*() [14/34]

template<class Num_T >

cvec operator* | ( | const ivec & | v,
|  | const std::complex< double > & | s
| ) |  |

related

Multiplication operator for ivec and complex<double>

Definition at line 300 of file operators.h.

## operator/() [8/14]

template<class Num_T >

ITPP_EXPORT cvec operator/ | ( | const std::complex< double > & | s,
|  | const ivec & | v
| ) |  |

related

Division operator for complex<double> and ivec.

Definition at line 126 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator/() [9/14]

template<class Num_T >

ITPP_EXPORT cvec operator/ | ( | const ivec & | v,
|  | const std::complex< double > & | s
| ) |  |

related

Division operator for ivec and complex<double>

Definition at line 137 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator+() [14/33]

template<class Num_T >

ITPP_EXPORT cvec operator+ | ( | const double & | s,
|  | const cvec & | v
| ) |  |

related

Addition operator for double and cvec.

Definition at line 150 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator+() [15/33]

template<class Num_T >

cvec operator+ | ( | const float & | s,
|  | const cvec & | v
| ) |  |

related

Addition operator for float and cvec.

Definition at line 326 of file operators.h.

## operator+() [16/33]

template<class Num_T >

cvec operator+ | ( | const short & | s,
|  | const cvec & | v
| ) |  |

related

Addition operator for short and cvec.

Definition at line 332 of file operators.h.

## operator+() [17/33]

template<class Num_T >

cvec operator+ | ( | const int & | s,
|  | const cvec & | v
| ) |  |

related

Addition operator for int and cvec.

Definition at line 338 of file operators.h.

## operator+() [18/33]

template<class Num_T >

cvec operator+ | ( | const cvec & | v,
|  | const float & | s
| ) |  |

related

Addition operator for cvec and float.

Definition at line 344 of file operators.h.

## operator+() [19/33]

template<class Num_T >

cvec operator+ | ( | const cvec & | v,
|  | const double & | s
| ) |  |

related

Addition operator for cvec and double.

Definition at line 350 of file operators.h.

## operator+() [20/33]

template<class Num_T >

cvec operator+ | ( | const cvec & | v,
|  | const short & | s
| ) |  |

related

Addition operator for cvec and short.

Definition at line 356 of file operators.h.

## operator+() [21/33]

template<class Num_T >

cvec operator+ | ( | const cvec & | v,
|  | const int & | s
| ) |  |

related

Addition operator for cvec and int.

Definition at line 362 of file operators.h.

## operator-() [15/34]

template<class Num_T >

ITPP_EXPORT cvec operator- | ( | const double & | s,
|  | const cvec & | v
| ) |  |

related

Subtraction operator for double and cvec.

Definition at line 161 of file operators.cpp.

References itpp::imag(), it_assert_debug, itpp::real(), and itpp::Array< T >::size().

## operator-() [16/34]

template<class Num_T >

cvec operator- | ( | const float & | s,
|  | const cvec & | v
| ) |  |

related

Subtraction operator for float and cvec.

Definition at line 374 of file operators.h.

## operator-() [17/34]

template<class Num_T >

cvec operator- | ( | const short & | s,
|  | const cvec & | v
| ) |  |

related

Subtraction operator for short and cvec.

Definition at line 380 of file operators.h.

## operator-() [18/34]

template<class Num_T >

cvec operator- | ( | const int & | s,
|  | const cvec & | v
| ) |  |

related

Subtraction operator for int and cvec.

Definition at line 386 of file operators.h.

## operator-() [19/34]

template<class Num_T >

cvec operator- | ( | const cvec & | v,
|  | const float & | s
| ) |  |

related

Subtraction operator for cvec and float.

Definition at line 392 of file operators.h.

## operator-() [20/34]

template<class Num_T >

cvec operator- | ( | const cvec & | v,
|  | const double & | s
| ) |  |

related

Subtraction operator for cvec and double.

Definition at line 398 of file operators.h.

## operator-() [21/34]

template<class Num_T >

cvec operator- | ( | const cvec & | v,
|  | const short & | s
| ) |  |

related

Subtraction operator for cvec and short.

Definition at line 404 of file operators.h.

## operator-() [22/34]

template<class Num_T >

cvec operator- | ( | const cvec & | v,
|  | const int & | s
| ) |  |

related

Subtraction operator for cvec and int.

Definition at line 410 of file operators.h.

## operator*() [15/34]

template<class Num_T >

ITPP_EXPORT cvec operator* | ( | const double & | s,
|  | const cvec & | v
| ) |  |

related

Multiplication operator for double and cvec.

Definition at line 172 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator*() [16/34]

template<class Num_T >

cvec operator* | ( | const float & | s,
|  | const cvec & | v
| ) |  |

related

Multiplication operator for float and cvec.

Definition at line 422 of file operators.h.

## operator*() [17/34]

template<class Num_T >

cvec operator* | ( | const short & | s,
|  | const cvec & | v
| ) |  |

related

Multiplication operator for short and cvec.

Definition at line 428 of file operators.h.

## operator*() [18/34]

template<class Num_T >

cvec operator* | ( | const int & | s,
|  | const cvec & | v
| ) |  |

related

Multiplication operator for int and cvec.

Definition at line 434 of file operators.h.

## operator*() [19/34]

template<class Num_T >

cvec operator* | ( | const cvec & | v,
|  | const float & | s
| ) |  |

related

Multiplication operator for cvec and float.

Definition at line 440 of file operators.h.

## operator*() [20/34]

template<class Num_T >

cvec operator* | ( | const cvec & | v,
|  | const double & | s
| ) |  |

related

Multiplication operator for cvec and double.

Definition at line 446 of file operators.h.

## operator*() [21/34]

template<class Num_T >

cvec operator* | ( | const cvec & | v,
|  | const short & | s
| ) |  |

related

Multiplication operator for cvec and short.

Definition at line 452 of file operators.h.

## operator*() [22/34]

template<class Num_T >

cvec operator* | ( | const cvec & | v,
|  | const int & | s
| ) |  |

related

Multiplication operator for cvec and int.

Definition at line 458 of file operators.h.

## operator/() [10/14]

template<class Num_T >

ITPP_EXPORT cvec operator/ | ( | const cvec & | v,
|  | const double & | s
| ) |  |

related

Division operator for cvec and double.

Definition at line 183 of file operators.cpp.

References it_assert_debug, and itpp::Array< T >::size().

## operator/() [11/14]

template<class Num_T >

ITPP_EXPORT cvec operator/ | ( | const double & | s,
|  | const cvec & | v
| ) |  |

related

Division operator for double and cvec.

Definition at line 194 of file operators.cpp.

## operator/() [12/14]

template<class Num_T >

cvec operator/ | ( | const cvec & | v,
|  | const float & | s
| ) |  |

related

Division operator for cvec and float.

Definition at line 476 of file operators.h.

## operator/() [13/14]

template<class Num_T >

cvec operator/ | ( | const cvec & | v,
|  | const short & | s
| ) |  |

related

Division operator for cvec and short.

Definition at line 482 of file operators.h.

## operator/() [14/14]

template<class Num_T >

cvec operator/ | ( | const cvec & | v,
|  | const int & | s
| ) |  |

related

Division operator for cvec and int.

Definition at line 488 of file operators.h.

## operator+() [22/33]

template<class Num_T >

ITPP_EXPORT vec operator+ | ( | const bvec & | a,
|  | const vec & | b
| ) |  |

related

Addition operator for bvec and vec.

Definition at line 290 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator+() [23/33]

template<class Num_T >

ITPP_EXPORT vec operator+ | ( | const svec & | a,
|  | const vec & | b
| ) |  |

related

Addition operator for svec and vec.

Definition at line 298 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator+() [24/33]

template<class Num_T >

ITPP_EXPORT vec operator+ | ( | const ivec & | a,
|  | const vec & | b
| ) |  |

related

Addition operator for ivec and vec.

Definition at line 306 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator+() [25/33]

template<class Num_T >

vec operator+ | ( | const vec & | a,
|  | const bvec & | b
| ) |  |

related

Addition operator for vec and bvec.

Definition at line 680 of file operators.h.

## operator+() [26/33]

template<class Num_T >

vec operator+ | ( | const vec & | a,
|  | const svec & | b
| ) |  |

related

Addition operator for vec and svec.

Definition at line 686 of file operators.h.

## operator+() [27/33]

template<class Num_T >

vec operator+ | ( | const vec & | a,
|  | const ivec & | b
| ) |  |

related

Addition operator for vec and ivec.

Definition at line 692 of file operators.h.

## operator-() [23/34]

template<class Num_T >

vec operator- | ( | const bvec & | a,
|  | const vec & | b
| ) |  |

related

Subtraction operator for bvec and vec.

Definition at line 698 of file operators.h.

## operator-() [24/34]

template<class Num_T >

vec operator- | ( | const svec & | a,
|  | const vec & | b
| ) |  |

related

Subtraction operator for svec and vec.

Definition at line 704 of file operators.h.

## operator-() [25/34]

template<class Num_T >

vec operator- | ( | const ivec & | a,
|  | const vec & | b
| ) |  |

related

Subtraction operator for ivec and vec.

Definition at line 710 of file operators.h.

## operator-() [26/34]

template<class Num_T >

vec operator- | ( | const vec & | a,
|  | const bvec & | b
| ) |  |

related

Subtraction operator for vec and bvec.

Definition at line 716 of file operators.h.

## operator-() [27/34]

template<class Num_T >

vec operator- | ( | const vec & | a,
|  | const svec & | b
| ) |  |

related

Subtraction operator for vec and svec.

Definition at line 722 of file operators.h.

## operator-() [28/34]

template<class Num_T >

vec operator- | ( | const vec & | a,
|  | const ivec & | b
| ) |  |

related

Subtraction operator for vec and ivec.

Definition at line 728 of file operators.h.

## operator*() [23/34]

template<class Num_T >

ITPP_EXPORT double operator* | ( | const bvec & | a,
|  | const vec & | b
| ) |  |

related

Multiplication operator for bvec and vec.

Definition at line 340 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator*() [24/34]

template<class Num_T >

ITPP_EXPORT double operator* | ( | const svec & | a,
|  | const vec & | b
| ) |  |

related

Multiplication operator for svec and vec.

Definition at line 348 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator*() [25/34]

template<class Num_T >

ITPP_EXPORT double operator* | ( | const ivec & | a,
|  | const vec & | b
| ) |  |

related

Multiplication operator for ivec and vec.

Definition at line 356 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator*() [26/34]

template<class Num_T >

double operator* | ( | const vec & | a,
|  | const bvec & | b
| ) |  |

related

Multiplication operator for vec and bvec.

Definition at line 752 of file operators.h.

## operator*() [27/34]

template<class Num_T >

double operator* | ( | const vec & | a,
|  | const svec & | b
| ) |  |

related

Multiplication operator for vec and svec.

Definition at line 758 of file operators.h.

## operator*() [28/34]

template<class Num_T >

double operator* | ( | const vec & | a,
|  | const ivec & | b
| ) |  |

related

Multiplication operator for vec and ivec.

Definition at line 764 of file operators.h.

## operator+() [28/33]

template<class Num_T >

ITPP_EXPORT cvec operator+ | ( | const bvec & | a,
|  | const cvec & | b
| ) |  |

related

Addition operator for bvec and cvec.

Definition at line 314 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator+() [29/33]

template<class Num_T >

ITPP_EXPORT cvec operator+ | ( | const svec & | a,
|  | const cvec & | b
| ) |  |

related

Addition operator for svec and cvec.

Definition at line 322 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator+() [30/33]

template<class Num_T >

ITPP_EXPORT cvec operator+ | ( | const ivec & | a,
|  | const cvec & | b
| ) |  |

related

Addition operator for ivec and cvec.

Definition at line 330 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator+() [31/33]

template<class Num_T >

cvec operator+ | ( | const cvec & | a,
|  | const bvec & | b
| ) |  |

related

Addition operator for cvec and bvec.

Definition at line 790 of file operators.h.

## operator+() [32/33]

template<class Num_T >

cvec operator+ | ( | const cvec & | a,
|  | const svec & | b
| ) |  |

related

Addition operator for cvec and svec.

Definition at line 796 of file operators.h.

## operator+() [33/33]

template<class Num_T >

cvec operator+ | ( | const cvec & | a,
|  | const ivec & | b
| ) |  |

related

Addition operator for cvec and ivec.

Definition at line 802 of file operators.h.

## operator-() [29/34]

template<class Num_T >

cvec operator- | ( | const bvec & | a,
|  | const cvec & | b
| ) |  |

related

Subtraction operator for bvec and cvec.

Definition at line 808 of file operators.h.

## operator-() [30/34]

template<class Num_T >

cvec operator- | ( | const svec & | a,
|  | const cvec & | b
| ) |  |

related

Subtraction operator for svec and cvec.

Definition at line 814 of file operators.h.

## operator-() [31/34]

template<class Num_T >

cvec operator- | ( | const ivec & | a,
|  | const cvec & | b
| ) |  |

related

Subtraction operator for ivec and cvec.

Definition at line 820 of file operators.h.

## operator-() [32/34]

template<class Num_T >

cvec operator- | ( | const cvec & | a,
|  | const bvec & | b
| ) |  |

related

Subtraction operator for cvec and bvec.

Definition at line 826 of file operators.h.

## operator-() [33/34]

template<class Num_T >

cvec operator- | ( | const cvec & | a,
|  | const svec & | b
| ) |  |

related

Subtraction operator for cvec and svec.

Definition at line 832 of file operators.h.

## operator-() [34/34]

template<class Num_T >

cvec operator- | ( | const cvec & | a,
|  | const ivec & | b
| ) |  |

related

Subtraction operator for cvec and ivec.

Definition at line 838 of file operators.h.

## operator*() [29/34]

template<class Num_T >

ITPP_EXPORT std::complex< double > operator* | ( | const bvec & | a,
|  | const cvec & | b
| ) |  |

related

Multiplication operator for bvec and cvec.

Definition at line 364 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator*() [30/34]

template<class Num_T >

ITPP_EXPORT std::complex< double > operator* | ( | const svec & | a,
|  | const cvec & | b
| ) |  |

related

Multiplication operator for svec and cvec.

Definition at line 372 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator*() [31/34]

template<class Num_T >

ITPP_EXPORT std::complex< double > operator* | ( | const ivec & | a,
|  | const cvec & | b
| ) |  |

related

Multiplication operator for ivec and cvec.

Definition at line 380 of file operators.cpp.

References it_assert_debug, itpp::Array< T >::size(), and itpp::Vec< Num_T >::size().

## operator*() [32/34]

template<class Num_T >

std::complex< double > operator* | ( | const cvec & | a,
|  | const bvec & | b
| ) |  |

related

Multiplication operator for cvec and bvec.

Definition at line 862 of file operators.h.

## operator*() [33/34]

template<class Num_T >

std::complex< double > operator* | ( | const cvec & | a,
|  | const svec & | b
| ) |  |

related

Multiplication operator for cvec and svec.

Definition at line 868 of file operators.h.

## operator*() [34/34]

template<class Num_T >

std::complex< double > operator* | ( | const cvec & | a,
|  | const ivec & | b
| ) |  |

related

Multiplication operator for cvec and ivec.

Definition at line 874 of file operators.h.

## sort()

template<class T >

void sort | ( | Vec< T > & | data,
|  | SORTING_METHOD | method = `INTROSORT`
| ) |  |

related

Sort the data vector in increasing order.

Parameters

  data | Vector to be sorted
  method | Sorting method: INTROSORT (default), QUICKSORT, HEAPSORT or INSERTSORT

Definition at line 187 of file sort.h.

References itpp::Array< T >::size().

## sort_index()

template<class T >

ivec sort_index | ( | const Vec< T > & | data,
|  | SORTING_METHOD | method = `INTROSORT`
| ) |  |

related

Return an index vector corresponding to a sorted vector data in increasing order.

Parameters

  data | Vector for which to return a sorted index vector
  method | Sorting method: INTROSORT (default), QUICKSORT, HEAPSORT or INSERTSORT

Definition at line 203 of file sort.h.

References itpp::Array< T >::size().

## vec_1()

template<class T >

Vec< T > vec_1 | ( | T | v0 | ) |

related

Vector of length 1.

Definition at line 322 of file specmat.h.

## vec_2()

template<class T >

Vec< T > vec_2 | ( | T | v0,
|  | T | v1
| ) |  |

related

Vector of length 2.

Definition at line 334 of file specmat.h.

## vec_3()

template<class T >

Vec< T > vec_3 | ( | T | v0,
|  | T | v1,
|  | T | v2
| ) |  |

related

Vector of length 3.

Definition at line 347 of file specmat.h.

## Member Data Documentation

## datasize

template<class Num_T >

int itpp::Vec< Num_T >::datasize

protected

The current number of elements in the vector.

Definition at line 503 of file vec.h.

Referenced by itpp::Vec< Num_T >::length(), itpp::Vec< Num_T >::size(), itpp::Vec< Num_T >::Vec(), and itpp::Vec< Num_T >::Vec().

## data

template<class Num_T >

Num_T* itpp::Vec< Num_T >::data

protected

A pointer to the data area.

Definition at line 505 of file vec.h.

Referenced by itpp::Vec< Num_T >::_data(), itpp::Vec< Num_T >::_data(), itpp::Vec< Num_T >::_elem(), itpp::Vec< Num_T >::_elem(), itpp::Vec< Num_T >::Vec(), itpp::Vec< Num_T >::Vec(), and itpp::Vec< Num_T >::Vec().

## factory

template<class Num_T >

const Factory& itpp::Vec< Num_T >::factory

protected

Element factory (set to DEFAULT_FACTORY to use Num_T default constructors only)

Definition at line 507 of file vec.h.

The documentation for this class was generated from the following files:

- itpp/base/factory.h
- itpp/base/vec.h
- itpp/base/converters.h
- itpp/base/matfunc.h
- itpp/base/operators.h
- itpp/base/sort.h
- itpp/base/specmat.h
- itpp/fixed/cfix.cpp
- itpp/fixed/cfix.h
- itpp/fixed/fix.cpp
- itpp/fixed/fix.h

Generated on Mon Apr 22 2024 09:45:27 for IT++ by Doxygen 1.9.8