Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

SPUC::Vec< T > Class Template Reference

Templated vectors. More...

#include <vector.h>

Collaboration diagram for SPUC::Vec< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Vec ()
 Constructor.
 Vec (int size)
 Constructor.
 Vec (const Vec< T > &v)
 Constructor.
 Vec (const char *values)
 Constructor.
 Vec (const string &values)
 Constructor.
 Vec (T *c_array, int size)
 Constructor taking a C-array as input. Copies all data.
 ~Vec ()
 Destructor.
int length () const
 The size of the vector.
int size () const
 The size of the vector.
void set_length (int size, bool copy=false)
 Set length of vector. if copy = true then keeping the old values.
void set_size (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.
bool set (const char *str)
 Set the vector equal to the values in the str string.
bool set (const string &str)
 Set the vector equal to the values in the str string.
operator[] (int i) const
 C-style index operator. First element is 0.
operator() (int i) const
 Index operator. First element is 0.
T & operator[] (int i)
 C-style index operator. First element is 0.
T & operator() (int i)
 Index operator. First element is 0.
const Vec< T > operator() (int i1, int i2) const
 Sub-vector with elements from i1 to i2. Index -1 indicates the last element.
const Vec< T > operator() (const Vec< int > &indexlist) const
 Sub-vector where the elements are given by the list indexlist.
void operator+= (const Vec< T > &v)
 Addition of vector.
void operator+= (T t)
 Addition of scalar.
void operator-= (const Vec< T > &v)
 Subtraction of vector.
void operator-= (T t)
 Subtraction of scalar.
void operator *= (T t)
 Multiply with a scalar.
void operator/= (T t)
 Elementwise division.
void operator/= (const Vec< T > &v)
 Elementwise division.
Vec< T > get (const Vec< bin > &binlist) const
 Get the elements in the vector where binlist is 1.
Vec< T > right (int nr) const
 Get the right nr elements from the vector.
Vec< T > left (int nr) const
 Get the left nr elements from the vector.
Vec< T > mid (int start, int nr) const
 Get the middle part of vector from start including nr elements.
Vec< T > split (int pos)
 Split the vector into two parts at element pos. Return the first part and keep the second.
void shift_right (T In, int n=1)
 Shift in element In at position 0 n times.
void shift_right (const Vec< T > &In)
 Shift in vector In at position 0.
void shift_left (T In, int n=1)
 Shift out the n left elements and a the same time shift in the element at last position n times.
void shift_left (const Vec< T > &In)
 Shift in vector In at last position.
void set_subvector (int i1, int i2, const Vec< T > &v)
 Set subvector defined by indicies i1 to i2 to vector v.
void set_subvector (int i1, int i2, const T t)
 Set subvector defined by indicies i1 to i2 to constant t.
void replace_mid (int pos, const Vec< T > &v)
 Replace the elements from pos by the vector v.
void del (int index)
 Delete element number index.
void ins (int index, T in)
 Insert element in at index.
void ins (int index, const Vec< T > &in)
 Insert vector in at index.
void operator= (T t)
 Assign all elements in vector to t.
void operator= (const Vec< T > &v)
 Assign vector the value and length of v.
void operator= (const Mat< T > &m)
 Assign vector equal to the 1-dimensional matrix m.
void operator= (const char *values)
 Assign vector the values in the string values.
Vec< binoperator== (const T value)
 Elementwise equal to the scalar.
Vec< binoperator!= (const T value)
 Elementwise not-equal to the scalar.
Vec< binoperator< (const T value)
 Elementwise less than the scalar.
Vec< binoperator<= (const T value)
 Elementwise less than and equal to the scalar.
Vec< binoperator> (const T value)
 Elementwise greater than the scalar.
Vec< binoperator>= (const T value)
 Elementwise greater than and equal to the scalar.
bool operator== (const Vec< T > &v) const
 Compare two vectors. False if wrong sizes or different values.
bool operator!= (const Vec< T > &v) const
 Compare two vectors. True if different.
T & _elem (int i)
 Index operator without boundary check. Not recommended to use.
_elem (int i) const
 Index operator without boundary check. Not recommended to use.
T * _data ()
 Get the pointer to the internal structure. Not recommended to use.
const T * _data () const
 Get the pointer to the internal structure. Not recommended to 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.
T * data
 A pointer to the data area.

Friends

Vec< T > operator+TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
 Addition of two vectors.
Vec< T > operator+TEMPLATE_FUN (const Vec< T > &v, T t)
 Addition of a vector and a scalar.
Vec< T > operator+TEMPLATE_FUN (T t, const Vec< T > &v)
 Addition of a scalar and a vector.
Vec< T > operator-TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
 Subtraction of v2 from v1.
Vec< T > operator-TEMPLATE_FUN (const Vec< T > &v, T t)
 Subtraction of scalar from vector.
Vec< T > operator-TEMPLATE_FUN (T t, const Vec< T > &v)
 Sutraction of vector from scalar.
Vec< T > operator-TEMPLATE_FUN (const Vec< T > &v)
 Negation of vector.
operator *TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
 Inner (dot) product.
T dot TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
 Inner (dot) product.
T dot_prod TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
Mat< T > outer_product TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
 Outer product of two vectors v1 and v2.
Vec< T > operator *TEMPLATE_FUN (const Vec< T > &v, T t)
 Elementwise multiplication of vector and scalar.
Vec< T > operator *TEMPLATE_FUN (T t, const Vec< T > &v)
 Elementwise multiplication of vector and scalar.
Vec< T > elem_mult TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
 Elementwise multiplication.
Vec< T > elem_mult TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2, const Vec< T > &v3)
 Elementwise multiplication of three vectors.
Vec< T > elem_mult TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2, const Vec< T > &v3, const Vec< T > &v4)
 Elementwise multiplication of four vectors.
Vec< T > operator/TEMPLATE_FUN (const Vec< T > &v, T t)
 Elementwise division.
Vec< T > operator/TEMPLATE_FUN (const T t, const Vec< T > &v)
 Elementwise division.
Vec< T > elem_div TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
 Elementwise division.
Vec< T > elem_div TEMPLATE_FUN (const T t, const Vec< T > &v)
 Elementwise division.
Vec< T > concat TEMPLATE_FUN (const Vec< T > &v, const T a)
 Append element a to the end of the vector v.
Vec< T > concat TEMPLATE_FUN (const T a, const Vec< T > &v)
 Concat element a to the beginning of the vector v.
Vec< T > concat TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2)
 Concat vectors v1 and v2.
Vec< T > concat TEMPLATE_FUN (const Vec< T > &v1, const Vec< T > &v2, const Vec< T > &v3)
 Concat vectors v1, v2 and v3.

Related Functions

(Note that these are not member functions.)

typedef Vec< double > vec
 Stream output of vector Definition of double vector type.
typedef Vec< complex< double > > cvec
 Definition of double_complex vector type.
typedef Vec< int > ivec
 Definition of integer vector type.
typedef Vec< long_long > llvec
 Definition of long_long vector type.
typedef Vec< short int > svec
 Definition of short vector type.
typedef Vec< binbvec
 Definition of binary vector type.
int length (const Vec< T > &v)
 Length of vector.
int size (const Vec< T > &v)
 Length of vector.
sum (const Vec< T > &v)
 Sum of all elements in the vector.
sum_sqr (const Vec< T > &v)
 Sum of square of the elements in a vector.
max (const Vec< T > &v)
 Maximum value of vector.
min (const Vec< T > &in)
 Minimum value of vector.
int max_index (const Vec< T > &in)
 Return the postion of the maximum element in the vector.
int min_index (const Vec< T > &in)
 Return the postion of the minimum element in the vector.
product (const Vec< T > &v)
 The product of all elements in the vector.
Vec< T > cross (const Vec< T > &v1, const Vec< T > &v2)
 Vector cross product. Vectors need to be of size 3.
double mean (const vec &v)
 The mean value.
complex< double > mean (const cvec &v)
 The mean value.
double mean (const svec &v)
 The mean value.
double mean (const ivec &v)
 The mean value.
double geometric_mean (const Vec< T > &v)
 The geometric mean value.
double median (const Vec< T > &v)
 The median.
double norm (const Vec< T > &v)
 Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2)).
double norm (const cvec &v)
 Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2)).
double norm (const Vec< T > &v, int p)
 Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p).
double norm (const cvec &v, int p)
 Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p).
double energy (const Vec< T > &v)
 The variance of the elements in the vector. Normalized with N-1 to be unbiased.The variance of the elements in the vector. Normalized with N-1 to be unbiased.Calculate the energy: squared 2-norm. energy(v)=sum(v.^2).
Vec< T > reverse (const Vec< T > &in)
 Reverse the input vector.
Vec< T > repeat (const Vec< T > &v, int norepeats)
 Repeat each element in the vector norepeats times in sequence.
Vec< T > apply_function (fT(*f)(fT), const Vec< T > &data)
 Apply arbitrary function to a vector.
void sort (Vec< T > &data)
 Sort the the vector in increasing order.
ivec sort_index (const Vec< T > &data)
 Return an index vector corresponding to a sorted vector (increasing order).
Vec< T > zero_pad (const Vec< T > &v, int n)
 Zero-pad a vector to size n.
Vec< T > zero_pad (const Vec< T > &v)
 Zero-pad a vector to the nearest greater power of two.
Mat< T > zero_pad (const Mat< T > &v, int rows, int cols)
 Zero-pad a matrix to size rows x cols.
void upsample (const Vec< T > &v, int usf, Vec< T > &u)
 Upsample a vector by incerting (usf-1) zeros after each sample.
Vec< T > upsample (const Vec< T > &v, int usf)
 Upsample a vector by incerting (usf-1) zeros after each sample.
Vec< T > vec_1 (T v0)
 Vector of length 1.
Vec< T > vec_2 (T v0, T v1)
 Vector of length 2.
Vec< T > vec_3 (T v0, T v1, T v2)
 Vector of length 3.

Detailed Description

template<class T>
class SPUC::Vec< T >

Templated vectors.

Author:
Tony Ottosson and Tobias Ringstrom
Vectors can be of arbitrarily types, but conversions and functions are prepared for bin, short, int, double, and double_complex vectors and these are predefined as: bvec, svec, ivec, vec, and cvec. double and double_complex are double and complex<double> respectively.

Examples:

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

 vec temp; 
For construction of a vector of a given length use
 vec temp(length); 
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 are 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); 
where false is used to indicate that the old values in temp is not copied. If you 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 most left elements (the first)
  a.right(10); // The 10 most right elements (the last)
  a.mid(5, 7); // 7 elements starting from element 5

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

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

It is of course also possible to perform the common linear algebra methods 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 available as operations on the individual elements of the vectors. Please see the individual functions for more details.


Constructor & Destructor Documentation

template<class T>
SPUC::Vec< T >::Vec  )  [inline]
 

Constructor.

template<class T>
SPUC::Vec< T >::Vec int  size  )  [inline, explicit]
 

Constructor.

Here is the call graph for this function:

template<class T>
SPUC::Vec< T >::Vec const Vec< T > &  v  )  [inline]
 

Constructor.

Here is the call graph for this function:

template<class T>
SPUC::Vec< T >::Vec const char *  values  )  [inline]
 

Constructor.

Here is the call graph for this function:

template<class T>
SPUC::Vec< T >::Vec const string &  values  )  [inline]
 

Constructor.

Here is the call graph for this function:

template<class T>
SPUC::Vec< T >::Vec T *  c_array,
int  size
[inline]
 

Constructor taking a C-array as input. Copies all data.

Here is the call graph for this function:

template<class T>
SPUC::Vec< T >::~Vec  )  [inline]
 

Destructor.

Here is the call graph for this function:


Member Function Documentation

template<class T>
const T* SPUC::Vec< T >::_data  )  const [inline]
 

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

template<class T>
T* SPUC::Vec< T >::_data  )  [inline]
 

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

template<class T>
T SPUC::Vec< T >::_elem int  i  )  const [inline]
 

Index operator without boundary check. Not recommended to use.

template<class T>
T& SPUC::Vec< T >::_elem int  i  )  [inline]
 

Index operator without boundary check. Not recommended to use.

template<class T>
void SPUC::Vec< T >::alloc int  size  )  [inline, protected]
 

Allocate storage for a vector of length size.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::clear  )  [inline]
 

Set the vector to the all zero vector.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::del int  index  ) 
 

Delete element number index.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::free  )  [inline, protected]
 

Free the storage space allocated by the vector.

template<class T>
Vec< T > SPUC::Vec< T >::get const Vec< bin > &  binlist  )  const
 

Get the elements in the vector where binlist is 1.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::ins int  index,
const Vec< T > &  in
 

Insert vector in at index.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::ins int  index,
in
 

Insert element in at index.

Here is the call graph for this function:

template<class T>
Vec< T > SPUC::Vec< T >::left int  nr  )  const [inline]
 

Get the left nr elements from the vector.

template<class T>
int SPUC::Vec< T >::length  )  const [inline]
 

The size of the vector.

template<class T>
Vec< T > SPUC::Vec< T >::mid int  start,
int  nr
const [inline]
 

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

template<class T>
void SPUC::Vec< T >::ones  )  [inline]
 

Set the vector to the all one vector.

template<class T>
void SPUC::Vec< T >::operator *= t  )  [inline]
 

Multiply with a scalar.

template<class T>
bool SPUC::Vec< T >::operator!= const Vec< T > &  v  )  const
 

Compare two vectors. True if different.

template<class T>
bvec SPUC::Vec< T >::operator!= const T  value  ) 
 

Elementwise not-equal to the scalar.

Here is the call graph for this function:

template<class T>
const Vec< T > SPUC::Vec< T >::operator() const Vec< int > &  indexlist  )  const
 

Sub-vector where the elements are given by the list indexlist.

Here is the call graph for this function:

template<class T>
const Vec< T > SPUC::Vec< T >::operator() int  i1,
int  i2
const [inline]
 

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

template<class T>
T& SPUC::Vec< T >::operator() int  i  )  [inline]
 

Index operator. First element is 0.

template<class T>
T SPUC::Vec< T >::operator() int  i  )  const [inline]
 

Index operator. First element is 0.

template<class T>
void SPUC::Vec< T >::operator+= t  )  [inline]
 

Addition of scalar.

template<class T>
void SPUC::Vec< T >::operator+= const Vec< T > &  v  )  [inline]
 

Addition of vector.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::operator-= t  )  [inline]
 

Subtraction of scalar.

template<class T>
void SPUC::Vec< T >::operator-= const Vec< T > &  v  )  [inline]
 

Subtraction of vector.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::operator/= const Vec< T > &  v  )  [inline]
 

Elementwise division.

template<class T>
void SPUC::Vec< T >::operator/= t  )  [inline]
 

Elementwise division.

template<class T>
bvec SPUC::Vec< T >::operator< const T  value  ) 
 

Elementwise less than the scalar.

Here is the call graph for this function:

template<class T>
bvec SPUC::Vec< T >::operator<= const T  value  ) 
 

Elementwise less than and equal to the scalar.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::operator= const char *  values  )  [inline]
 

Assign vector the values in the string values.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::operator= const Mat< T > &  m  )  [inline]
 

Assign vector equal to the 1-dimensional matrix m.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::operator= const Vec< T > &  v  )  [inline]
 

Assign vector the value and length of v.

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::operator= t  )  [inline]
 

Assign all elements in vector to t.

template<class T>
bool SPUC::Vec< T >::operator== const Vec< T > &  v  )  const
 

Compare two vectors. False if wrong sizes or different values.

template<class T>
bvec SPUC::Vec< T >::operator== const T  value  ) 
 

Elementwise equal to the scalar.

Here is the call graph for this function:

template<class T>
bvec SPUC::Vec< T >::operator> const T  value  ) 
 

Elementwise greater than the scalar.

Here is the call graph for this function:

template<class T>
bvec SPUC::Vec< T >::operator>= const T  value  ) 
 

Elementwise greater than and equal to the scalar.

Here is the call graph for this function:

template<class T>
T& SPUC::Vec< T >::operator[] int  i  )  [inline]
 

C-style index operator. First element is 0.

template<class T>
T SPUC::Vec< T >::operator[] int  i  )  const [inline]
 

C-style index operator. First element is 0.

template<class T>
void SPUC::Vec< T >::replace_mid int  pos,
const Vec< T > &  v
 

Replace the elements from pos by the vector v.

template<class T>
Vec< T > SPUC::Vec< T >::right int  nr  )  const [inline]
 

Get the right nr elements from the vector.

template<class T>
bool SPUC::Vec< T >::set const string &  str  ) 
 

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

Here is the call graph for this function:

template<class T>
bool SPUC::Vec< T >::set const char *  str  ) 
 

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

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::set_length int  size,
bool  copy = false
[inline]
 

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

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::set_size int  size,
bool  copy = false
 

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

Here is the call graph for this function:

template<class T>
void SPUC::Vec< T >::set_subvector int  i1,
int  i2,
const T  t
 

Set subvector defined by indicies i1 to i2 to constant t.

template<class T>
void SPUC::Vec< T >::set_subvector int  i1,
int  i2,
const Vec< T > &  v
[inline]
 

Set subvector defined by indicies i1 to i2 to vector v.

template<class T>
void SPUC::Vec< T >::shift_left const Vec< T > &  In  ) 
 

Shift in vector In at last position.

template<class T>
void SPUC::Vec< T >::shift_left In,
int  n = 1
 

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

template<class T>
void SPUC::Vec< T >::shift_right const Vec< T > &  In  ) 
 

Shift in vector In at position 0.

template<class T>
void SPUC::Vec< T >::shift_right In,
int  n = 1
 

Shift in element In at position 0 n times.

template<class T>
int SPUC::Vec< T >::size void   )  const [inline]
 

The size of the vector.

template<class T>
Vec< T > SPUC::Vec< T >::split int  pos  ) 
 

Split the vector into two parts at element pos. Return the first part and keep the second.

template<class T>
void SPUC::Vec< T >::zeros  )  [inline]
 

Set the vector to the all zero vector.


Friends And Related Function Documentation

template<class T>
Vec< T > apply_function fT(*)(fT)  f,
const Vec< T > &  data
[related]
 

Apply arbitrary function to a vector.

template<class T>
typedef Vec<bin> bvec [related]
 

Definition of binary vector type.

template<class T>
Vec< T > cross const Vec< T > &  v1,
const Vec< T > &  v2
[related]
 

Vector cross product. Vectors need to be of size 3.

template<class T>
typedef Vec<complex<double> > cvec [related]
 

Definition of double_complex vector type.

template<class T>
double energy const Vec< T > &  v  )  [related]
 

The variance of the elements in the vector. Normalized with N-1 to be unbiased.The variance of the elements in the vector. Normalized with N-1 to be unbiased.Calculate the energy: squared 2-norm. energy(v)=sum(v.^2).

template<class T>
double geometric_mean const Vec< T > &  v  )  [related]
 

The geometric mean value.

template<class T>
typedef Vec<int> ivec [related]
 

Definition of integer vector type.

template<class T>
int length const Vec< T > &  v  )  [related]
 

Length of vector.

Here is the call graph for this function:

template<class T>
typedef Vec<long_long> llvec [related]
 

Definition of long_long vector type.

template<class T>
T max const Vec< T > &  v  )  [related]
 

Maximum value of vector.

template<class T>
int max_index const Vec< T > &  in  )  [related]
 

Return the postion of the maximum element in the vector.

template<class T>
double mean const ivec v  )  [related]
 

The mean value.

template<class T>
double mean const svec v  )  [related]
 

The mean value.

template<class T>
complex< double > mean const cvec v  )  [related]
 

The mean value.

template<class T>
double mean const vec v  )  [related]
 

The mean value.

template<class T>
double median const Vec< T > &  v  )  [related]
 

The median.

template<class T>
T min const Vec< T > &  in  )  [related]
 

Minimum value of vector.

template<class T>
int min_index const Vec< T > &  in  )  [related]
 

Return the postion of the minimum element in the vector.

template<class T>
double norm const cvec v,
int  p
[related]
 

Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p).

template<class T>
double norm const Vec< T > &  v,
int  p
[related]
 

Calculate the p-norm: norm(v,p)=sum(abs(v).^2)^(1/p).

template<class T>
double norm const cvec v  )  [related]
 

Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2)).

template<class T>
double norm const Vec< T > &  v  )  [related]
 

Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2)).

template<class T>
Vec<T> operator *TEMPLATE_FUN t,
const Vec< T > &  v
[friend]
 

Elementwise multiplication of vector and scalar.

template<class T>
Vec<T> operator *TEMPLATE_FUN const Vec< T > &  v,
t
[friend]
 

Elementwise multiplication of vector and scalar.

template<class T>
T operator *TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

Inner (dot) product.

template<class T>
Vec<T> operator+TEMPLATE_FUN t,
const Vec< T > &  v
[friend]
 

Addition of a scalar and a vector.

template<class T>
Vec<T> operator+TEMPLATE_FUN const Vec< T > &  v,
t
[friend]
 

Addition of a vector and a scalar.

template<class T>
Vec<T> operator+TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

Addition of two vectors.

template<class T>
Vec<T> operator-TEMPLATE_FUN const Vec< T > &  v  )  [friend]
 

Negation of vector.

template<class T>
Vec<T> operator-TEMPLATE_FUN t,
const Vec< T > &  v
[friend]
 

Sutraction of vector from scalar.

template<class T>
Vec<T> operator-TEMPLATE_FUN const Vec< T > &  v,
t
[friend]
 

Subtraction of scalar from vector.

template<class T>
Vec<T> operator-TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

Subtraction of v2 from v1.

template<class T>
Vec<T> operator/TEMPLATE_FUN const T  t,
const Vec< T > &  v
[friend]
 

Elementwise division.

template<class T>
Vec<T> operator/TEMPLATE_FUN const Vec< T > &  v,
t
[friend]
 

Elementwise division.

template<class T>
T product const Vec< T > &  v  )  [related]
 

The product of all elements in the vector.

template<class T>
Vec< T > repeat const Vec< T > &  v,
int  norepeats
[related]
 

Repeat each element in the vector norepeats times in sequence.

template<class T>
Vec< T > reverse const Vec< T > &  in  )  [related]
 

Reverse the input vector.

template<class T>
int size const Vec< T > &  v  )  [related]
 

Length of vector.

Here is the call graph for this function:

template<class T>
void sort Vec< T > &  data  )  [related]
 

Sort the the vector in increasing order.

template<class T>
ivec sort_index const Vec< T > &  data  )  [related]
 

Return an index vector corresponding to a sorted vector (increasing order).

template<class T>
T sum const Vec< T > &  v  )  [related]
 

Sum of all elements in the vector.

template<class T>
T sum_sqr const Vec< T > &  v  )  [related]
 

Sum of square of the elements in a vector.

template<class T>
typedef Vec<short int> svec [related]
 

Definition of short vector type.

template<class T>
Vec<T> concat TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2,
const Vec< T > &  v3
[friend]
 

Concat vectors v1, v2 and v3.

template<class T>
Vec<T> concat TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

Concat vectors v1 and v2.

template<class T>
Vec<T> concat TEMPLATE_FUN const T  a,
const Vec< T > &  v
[friend]
 

Concat element a to the beginning of the vector v.

template<class T>
Vec<T> concat TEMPLATE_FUN const Vec< T > &  v,
const T  a
[friend]
 

Append element a to the end of the vector v.

template<class T>
Vec<T> elem_div TEMPLATE_FUN const T  t,
const Vec< T > &  v
[friend]
 

Elementwise division.

template<class T>
Vec<T> elem_div TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

Elementwise division.

template<class T>
Vec<T> elem_mult TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2,
const Vec< T > &  v3,
const Vec< T > &  v4
[friend]
 

Elementwise multiplication of four vectors.

template<class T>
Vec<T> elem_mult TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2,
const Vec< T > &  v3
[friend]
 

Elementwise multiplication of three vectors.

template<class T>
Vec<T> elem_mult TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

Elementwise multiplication.

template<class T>
Mat<T> outer_product TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

Outer product of two vectors v1 and v2.

template<class T>
T dot_prod TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

template<class T>
T dot TEMPLATE_FUN const Vec< T > &  v1,
const Vec< T > &  v2
[friend]
 

Inner (dot) product.

template<class T>
Vec< T > upsample const Vec< T > &  v,
int  usf
[related]
 

Upsample a vector by incerting (usf-1) zeros after each sample.

template<class T>
void upsample const Vec< T > &  v,
int  usf,
Vec< T > &  u
[related]
 

Upsample a vector by incerting (usf-1) zeros after each sample.

template<class T>
typedef Vec<double> vec [related]
 

Stream output of vector Definition of double vector type.

template<class T>
Vec< T > vec_1 v0  )  [related]
 

Vector of length 1.

template<class T>
Vec< T > vec_2 v0,
v1
[related]
 

Vector of length 2.

template<class T>
Vec< T > vec_3 v0,
v1,
v2
[related]
 

Vector of length 3.

template<class T>
Mat< T > zero_pad const Mat< T > &  v,
int  rows,
int  cols
[related]
 

Zero-pad a matrix to size rows x cols.

template<class T>
Vec< T > zero_pad const Vec< T > &  v  )  [related]
 

Zero-pad a vector to the nearest greater power of two.

template<class T>
Vec< T > zero_pad const Vec< T > &  v,
int  n
[related]
 

Zero-pad a vector to size n.


Member Data Documentation

template<class T>
T* SPUC::Vec< T >::data [protected]
 

A pointer to the data area.

template<class T>
int SPUC::Vec< T >::datasize [protected]
 

The current number of elements in the vector.


The documentation for this class was generated from the following files:
Generated on Fri Sep 16 11:09:37 2005 for spuc by  doxygen 1.4.4