Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Vector< S > Class Template Reference

#include <Matrix.h>

List of all members.


Detailed Description

template<class S>
class Vector< S >

Straightforward array based vector with elements of type S. If S is a user defined type the default constructor will be called to determine the size of the vector elements.

Provides the overloaded operators +=,/= needed for use in RandomObjects as componentwise operations on the coordinate type.

Definition at line 128 of file Matrix.h.

Public Member Functions

int getDimension () const
void setDimension (int d)
int getIndexBase () const
void setIndexBase (int base)
S * getData () const
S & operator[] (int i)
const S & operator[] (int i) const
 ~Vector ()
 Vector (int d, int base=0)
 Vector (const Vector &v)
 Vector (int n, S &v)
 Vector (int n, S *a)
template<int n>  Vector (S a[n])
Vector & operator= (const Vector &x)
Vector & switchComponents (int i, int j)
Vector & operator+= (const Vector &x)
Vector & operator-= (const Vector &x)
Vector & operator/= (int N)
Vector & operator *= (const S &lambda)
template<typename MatrixBaseType> Vector & operator *= (const Matrix< S, MatrixBaseType > &A)
mean () const
Real norm () const
void testEquals (const Vector< S > &v, S precision, S epsilon, string test) const
std::ostream & printSelf (std::ostream &os) const

Protected Attributes

int dim
int b
S * dptr


Constructor & Destructor Documentation

template<class S>
Vector< S >::~Vector   [inline]
 

Definition at line 171 of file Matrix.h.

template<class S>
Vector< S >::Vector int    d,
int    base = 0
[inline, explicit]
 

Constructor initializes with zeroes

Definition at line 175 of file Matrix.h.

template<class S>
Vector< S >::Vector const Vector< S > &    v [inline]
 

Definition at line 183 of file Matrix.h.

template<class S>
Vector< S >::Vector int    n,
S &    v
[inline]
 

Initialize all entries with the same value, index base is b=0.

Parameters:
n dimension
v constant entry

Definition at line 197 of file Matrix.h.

template<class S>
Vector< S >::Vector int    n,
S *    a
[inline]
 

Construct from data array, index base is b=0.

Parameters:
n dimension
a data array

Definition at line 209 of file Matrix.h.

template<class S>
template<int n>
Vector< S >::Vector   a[n] [inline]
 

Construct from data array, index base is b=0.

Parameters:
a data array

Definition at line 219 of file Matrix.h.


Member Function Documentation

template<class S>
int Vector< S >::getDimension   const [inline]
 

Dimension.

Definition at line 141 of file Matrix.h.

Referenced by Vector< Real >::operator=(), Matrix< Real, UpperTriangular< Real > >::quadraticForm(), and Vector< Real >::testEquals().

template<class S>
void Vector< S >::setDimension int    d [inline]
 

Sets new dimension, only downsizing, no new memory allocated.

Definition at line 143 of file Matrix.h.

template<class S>
int Vector< S >::getIndexBase   const [inline]
 

Index base b: indices i=b,b+1,...,b+dim-1.

Definition at line 145 of file Matrix.h.

Referenced by Vector< Real >::operator=(), Matrix< Real, UpperTriangular< Real > >::quadraticForm(), and Vector< Real >::testEquals().

template<class S>
void Vector< S >::setIndexBase int    base [inline]
 

Set index base b: indices i=b,b+1,...,b+dim-1.

Definition at line 147 of file Matrix.h.

template<class S>
S* Vector< S >::getData   const [inline]
 

Definition at line 148 of file Matrix.h.

Referenced by Vector< Real >::operator+=(), Vector< Real >::operator-=(), and Vector< Real >::operator=().

template<class S>
S& Vector< S >::operator[] int    i [inline]
 

Subscripting relative to index base.

Definition at line 152 of file Matrix.h.

template<class S>
const S& Vector< S >::operator[] int    i const [inline]
 

Subscripting relative to index base.

Definition at line 161 of file Matrix.h.

template<class S>
Vector& Vector< S >::operator= const Vector< S > &    x [inline]
 

Dimension of x must be less than or equal to the dimension of this, no new memory allocated.

Definition at line 228 of file Matrix.h.

template<class S>
Vector& Vector< S >::switchComponents int    i,
int    j
[inline]
 

Switch components i,j. Indexing based on the index base of the vector.

Definition at line 244 of file Matrix.h.

template<class S>
Vector& Vector< S >::operator+= const Vector< S > &    x [inline]
 

dimension must be same (not checked), index bases need not be same, index base remains unchanged.

Definition at line 253 of file Matrix.h.

template<class S>
Vector& Vector< S >::operator-= const Vector< S > &    x [inline]
 

dimension must be same (not checked), index bases need not be same, index base remains unchanged.

Definition at line 263 of file Matrix.h.

template<class S>
Vector& Vector< S >::operator/= int    N [inline]
 

division by integer (for use with class RandomObject)

Definition at line 272 of file Matrix.h.

template<class S>
Vector& Vector< S >::operator *= const S &    lambda [inline]
 

multiplication by scalar

Definition at line 282 of file Matrix.h.

template<class S>
template<typename MatrixBaseType>
Vector& Vector< S >::operator *= const Matrix< S, MatrixBaseType > &    A [inline]
 

Left multiplication by matrix A

Definition at line 292 of file Matrix.h.

template<class S>
S Vector< S >::mean   const [inline]
 

Arithmetic mean of the components.

Definition at line 312 of file Matrix.h.

template<class S>
Real Vector< S >::norm   const [inline]
 

The euclidean norm. Type S must support an absolute value fabs(S& s) mapping to Real.

Definition at line 322 of file Matrix.h.

template<class S>
void Vector< S >::testEquals const Vector< S > &    v,
  precision,
  epsilon,
string    test
const [inline]
 

Test for entry by entry equality. Type S must support absolute value and comparison ">". Equality is defined by an upper bound on the acceptable relative error in percent.

Parameters:
v vector to compare this with.
precision upper bound on the acceptable relative error in percent.
epsilon zero denominator reset to epsilon, should be smaller than relevant orders of magnitude.
test string printed to identify test.

Definition at line 345 of file Matrix.h.

template<class S>
std::ostream& Vector< S >::printSelf std::ostream &    os const [inline]
 

Definition at line 371 of file Matrix.h.


Member Data Documentation

template<class S>
int Vector< S >::dim [protected]
 

Definition at line 132 of file Matrix.h.

template<class S>
int Vector< S >::b [protected]
 

Definition at line 133 of file Matrix.h.

template<class S>
S* Vector< S >::dptr [protected]
 

Definition at line 134 of file Matrix.h.


The documentation for this class was generated from the following file:
Generated on Mon Sep 22 02:16:33 2003 for Libor-Library by doxygen1.3-rc3