BIAS::Vector< T > Class Template Reference
[Matrix and Vector Classes]

class for column vectors with arbitrary size More...

#include <Base/Math/Vector.hh>

Inheritance diagram for BIAS::Vector< T >:

Inheritance graph
[legend]
Collaboration diagram for BIAS::Vector< T >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef const Tconst_iterator
typedef const Tconst_reference
typedef T element_type
typedef Titerator
typedef Tpointer
typedef Treference
typedef Subscript size_type
typedef T value_type

Public Member Functions

const iterator begin () const
iterator begin ()
void clear ()
 stl conform interface JW
Subscript dim () const
double Dist (const Vector< T > &vec) const
 Return the euclidian distance of 2 vectors.
Vector< TElementwiseProduct (const Vector< T > &arg) const
 multiply this with arg elementwise and return the result
void ElementwiseProduct (const Vector< T > &arg, Vector< T > &dest) const
 multiply this with arg elementwise and store the result in dest
const iterator end () const
iterator end ()
void Fill (const T &scalar)
 fills complete Vector with scalar value
TGetData () const
 get the pointer to the data array of the vector (for faster direct memory access)
TGetDataLast () const
 Get the pointer to last element of the data array.
double GetMean (void) const
int GetNumElements () const
 conformance interface JW
std::vector< TGetSTLVec () const
void GetSTLVec (std::vector< T > &vec) const
bool IsZero () const
void KroneckerProduct (const Vector< T > &arg, Vector< T > &dst) const
 kronecker product
Subscript lbound () const
double Length () const
 returns the Euclidean Length of the Vector
bool Load (const std::string &filename)
 method to load directly from a given filename.
void Multiply (const T &scalar, Vector< T > &res) const
 multiply components with scalar storing result in res
void MultiplyIP (const T &scalar)
 in place multiplication with scalar
Vector< T > & newsize (Subscript N)
T NormL1 () const
 Return the L1 norm: |a| + |b| + |c| + .
double NormL2 () const
 Return the L2 norm: sqrt(a^1 + a^2 + .
bool operator!= (const Vector< T > &vec) const
const_reference operator() (Subscript i) const
reference operator() (Subscript i)
void operator*= (T scalar)
void operator+= (const Vector< T > &vec)
void operator-= (const Vector< T > &vec)
void operator/= (T scalar)
Vector< T > & operator= (const Vector< T > &vec)
 assignment operator calling corresponding operator from base class "TNT::Vector" if appropriate
Vector< T > & operator= (const TNT::Vector< T > &vec)
 assignment operators calling corresponding operator from base class "TNT::Vector" if appropriate
bool operator== (const Vector< T > &vec) const
const_reference operator[] (Subscript i) const
reference operator[] (Subscript i)
Matrix< TOuterProduct (const Vector< T > &v) const
 outer product, constructs a matrix.
bool Save (const std::string &filename) const
 method to save directly to a given filename.
void ScalarProduct (const Vector< T > &argvec, T &result) const
 scalar product (inner product) of two vectors returning a scalar, storing the result in result
T ScalarProduct (const Vector< T > &argvec) const
 scalar product (inner product) of two vectors returning a scalr
void Set (const T &scalar)
void SetZero ()
 equivalent to matrix call
Subscript size () const
unsigned int Size () const
 length of the vector
void Sub (const Vector< T > &arg, Vector< T > &dest) const
 Substraction of vector, storing results in destination vector.
void SubIP (const Vector< T > &argmat)
 in place subtracting
Vector< TSubVec (int length, int offset=0) const
 returns the subvector with elements between offset and offset+length-1
 Vector (const std::vector< T > &v)
 Vector (const Vector4< T > &v)
 Vector (const Vector3< T > &v)
 Vector (const Vector2< T > &v)
 Vector (const TNT::Vector< T > &v)
 Vector (const Vector< T > &v)
 Vector (int rows, const T *v)
 Vector (int rows, const T &value)
 assignment with a constant value for all elements (=set)
 Vector (const int rows, const std::string &s)
 JW.
 Vector (const int rows)
 Vector ()
virtual ~Vector ()

Protected Member Functions

void copy (const T *v)
void destroy ()
void initialize (Subscript N)
void set (const T &val)

Protected Attributes

Subscript n_
Tv_
Tvm1_

Related Functions

(Note that these are not member functions.)

template<class T >
Vector< Toperator* (const Matrix< T > &mat, const Vector2< T > &vec)
template<class T >
T operator* (const Vector< T > &v, const Vector< T > &argvec)
template<class T >
Vector< Toperator* (const T &scalar, const Vector< T > &v)
template<class T >
Vector< Toperator* (const Vector< T > &v, const T &scalar)
template<class T >
std::ostream & operator<< (std::ostream &os, const BIAS::Vector< T > &vec)


Detailed Description

template<class T = double>
class BIAS::Vector< T >

class for column vectors with arbitrary size

class Vector is the vector class that should be used by common BIAS algorithms and data structures. It is derived from TNT::Vector to inherit the basic operations and algorithm. Special implementations should be done here and NOT in TNT:Vector because the true 'base' Matrix class "TNT::Vector" should be interchangeable and aside from this maintained by NIST.

changed from BIAS to BIAS 11/05/2002 (jw)

The Vector is in row-major order (=n rows, 1 column)

Author:
Jan Woetzel

Definition at line 67 of file Vector.hh.


Member Typedef Documentation

template<class T >
typedef const T* TNT::Vector< T >::const_iterator [inherited]

Definition at line 67 of file vec.h.

template<class T >
typedef const T& TNT::Vector< T >::const_reference [inherited]

Definition at line 68 of file vec.h.

template<class T >
typedef T TNT::Vector< T >::element_type [inherited]

Definition at line 63 of file vec.h.

template<class T >
typedef T* TNT::Vector< T >::iterator [inherited]

Definition at line 65 of file vec.h.

template<class T >
typedef T* TNT::Vector< T >::pointer [inherited]

Definition at line 64 of file vec.h.

template<class T >
typedef T& TNT::Vector< T >::reference [inherited]

Definition at line 66 of file vec.h.

template<class T >
typedef Subscript TNT::Vector< T >::size_type [inherited]

Definition at line 61 of file vec.h.

template<class T >
typedef T TNT::Vector< T >::value_type [inherited]

Definition at line 62 of file vec.h.


Constructor & Destructor Documentation

template<class T >
Vector::~Vector (  )  [inline, virtual]

Reimplemented from TNT::Vector< T >.

Definition at line 43 of file Vector.cpp.

template<class T = double>
BIAS::Vector< T >::Vector (  )  [inline]

Reimplemented from TNT::Vector< T >.

Definition at line 73 of file Vector.hh.

template<class T = double>
BIAS::Vector< T >::Vector ( const int  rows  )  [inline, explicit]

Definition at line 75 of file Vector.hh.

template<class T >
Vector::Vector ( const int  rows,
const std::string &  s 
) [inline, explicit]

JW.

Definition at line 47 of file Vector.cpp.

template<class T = double>
BIAS::Vector< T >::Vector ( int  rows,
const T value 
) [inline]

assignment with a constant value for all elements (=set)

Author:
Jan Woetzel

Definition at line 85 of file Vector.hh.

template<class T = double>
BIAS::Vector< T >::Vector ( int  rows,
const T v 
) [inline]

Definition at line 87 of file Vector.hh.

template<class T = double>
BIAS::Vector< T >::Vector ( const Vector< T > &  v  )  [inline]

Definition at line 89 of file Vector.hh.

template<class T = double>
BIAS::Vector< T >::Vector ( const TNT::Vector< T > &  v  )  [inline]

Author:
JMF

Reimplemented from TNT::Vector< T >.

Definition at line 93 of file Vector.hh.

template<class T >
Vector::Vector ( const Vector2< T > &  v  )  [inline]

Author:
fw

Definition at line 53 of file Vector.cpp.

template<class T >
Vector::Vector ( const Vector3< T > &  v  )  [inline]

Author:
fw

Definition at line 59 of file Vector.cpp.

template<class T >
Vector::Vector ( const Vector4< T > &  v  )  [inline]

Author:
fw

Definition at line 65 of file Vector.cpp.

template<class T >
Vector::Vector ( const std::vector< T > &  v  )  [inline, explicit]

Definition at line 71 of file Vector.cpp.

References BIAS::Vector< T >::Size().


Member Function Documentation

template<class T >
const iterator TNT::Vector< T >::begin (  )  const [inline, inherited]

Definition at line 166 of file vec.h.

template<class T >
iterator TNT::Vector< T >::begin (  )  [inline, inherited]

template<class T = double>
void BIAS::Vector< T >::clear (  )  [inline]

stl conform interface JW

Definition at line 161 of file Vector.hh.

template<class T >
void TNT::Vector< T >::copy ( const T v  )  [inline, protected, inherited]

template<class T >
void TNT::Vector< T >::destroy (  )  [inline, protected, inherited]

template<class T >
Subscript TNT::Vector< T >::dim (  )  const [inline, inherited]

template<class T >
double BIAS::Vector< T >::Dist ( const Vector< T > &  vec  )  const [inline]

Return the euclidian distance of 2 vectors.

Author:
Birger Streckel
Date:
08/2002

Definition at line 424 of file Vector.hh.

References BIASASSERT, BIAS::Vector< T >::GetData(), BIAS::Vector< T >::GetDataLast(), TNT::Vector< T >::size(), and T.

template<class T >
Vector< T > BIAS::Vector< T >::ElementwiseProduct ( const Vector< T > &  arg  )  const [inline]

multiply this with arg elementwise and return the result

Author:
woelk 12/2004

Definition at line 459 of file Vector.hh.

References BIAS::Vector< T >::ElementwiseProduct().

template<class T >
void BIAS::Vector< T >::ElementwiseProduct ( const Vector< T > &  arg,
Vector< T > &  dest 
) const [inline]

template<class T >
const iterator TNT::Vector< T >::end (  )  const [inline, inherited]

Definition at line 167 of file vec.h.

template<class T >
iterator TNT::Vector< T >::end (  )  [inline, inherited]

Definition at line 165 of file vec.h.

template<class T >
void Vector::Fill ( const T scalar  )  [inline]

template<class T = double>
T* BIAS::Vector< T >::GetData (  )  const [inline]

template<class T = double>
T* BIAS::Vector< T >::GetDataLast (  )  const [inline]

Get the pointer to last element of the data array.

Author:
Ingo Thomsen
Date:
04/11/2002
Returns:
pointer to last element

Definition at line 221 of file Vector.hh.

Referenced by BIAS::Vector< T >::Dist(), BIAS::Vector< T >::NormL1(), and BIAS::Vector< T >::NormL2().

template<class T >
double Vector::GetMean ( void   )  const [inline]

Author:
Ove Schimmer, www.sequid.com
Date:
2008-07-17

Definition at line 198 of file Vector.cpp.

template<class T = double>
int BIAS::Vector< T >::GetNumElements (  )  const [inline]

conformance interface JW

Definition at line 142 of file Vector.hh.

Referenced by BIAS::glfShaderProgram::SetUniform().

template<class T >
std::vector< T > Vector::GetSTLVec (  )  const [inline]

Definition at line 189 of file Vector.cpp.

template<class T >
void Vector::GetSTLVec ( std::vector< T > &  vec  )  const [inline]

Author:
woelk 11/2007 (c) www.vision-n.de

Definition at line 178 of file Vector.cpp.

References BIAS::Vector< T >::Size().

Referenced by BIAS::ProjectionParametersCylindric::XMLOut().

template<class T >
void TNT::Vector< T >::initialize ( Subscript  N  )  [inline, protected, inherited]

template<class T >
bool Vector::IsZero (  )  const [inline]

Returns:
true if all elements are equal zero JW

Definition at line 125 of file Vector.cpp.

References TNT::Vector< T >::size(), T, and TNT::Vector< T >::v_.

Referenced by BIAS::TriangleMesh::TestContraction().

template<class T >
void Vector::KroneckerProduct ( const Vector< T > &  arg,
Vector< T > &  dst 
) const [inline]

kronecker product

Author:
woelk 08/2004

Definition at line 109 of file Vector.cpp.

References TNT::Vector< T >::newsize(), and TNT::Vector< T >::size().

Referenced by BIAS::Triangulation::GetCovarianceProjective().

template<class T >
Subscript TNT::Vector< T >::lbound (  )  const [inline, inherited]

Definition at line 70 of file vec.h.

Referenced by TNT::QR_factor(), TNT::QR_solve(), and TNT::R_solve().

template<class T = double>
double BIAS::Vector< T >::Length (  )  const [inline]

returns the Euclidean Length of the Vector

Definition at line 134 of file Vector.hh.

template<class T >
bool Vector::Load ( const std::string &  filename  )  [inline]

method to load directly from a given filename.

internally using stream operator

Author:
Jan Woetzel 09/2005
Returns:
false in case of error, true in case of success

Definition at line 149 of file Vector.cpp.

template<class T >
void BIAS::Vector< T >::Multiply ( const T scalar,
Vector< T > &  res 
) const [inline]

multiply components with scalar storing result in res

Author:
Ingo Thomsen tested(03/11/2002)

Definition at line 366 of file Vector.hh.

References TNT::Vector< T >::size(), and TNT::Vector< T >::v_.

Referenced by BIAS::Vector< T >::operator*().

template<class T = double>
void BIAS::Vector< T >::MultiplyIP ( const T scalar  )  [inline]

in place multiplication with scalar

Author:
Ingo Thomsen untested

Definition at line 197 of file Vector.hh.

Referenced by BIAS::Condensation::CalculateMean_(), and main().

template<class T >
Vector<T>& TNT::Vector< T >::newsize ( Subscript  N  )  [inline, inherited]

Definition at line 220 of file vec.h.

Referenced by BIAS::GenSynthMatches::_AddParameter(), BIAS::Binomial< InputStorageType, OutputStorageType >::_CalculateKernel(), BIAS::Param::AddParamVecDbl(), BIAS::Param::AddParamVecInt(), BIAS::CheckJacobian(), BIAS::ContourDetectorBSpline< StorageType >::CPntsToQ_(), BIAS::FilterMask::CreateFloatFilter(), BIAS::FilterMask::CreateIntFilter(), TNT::eigenproblem_special_quadratic_matrix_solve(), TNT::eigenvalue_solve(), BIAS::Vector< T >::ElementwiseProduct(), BIAS::CamPoseCalib::Estimate(), BIAS::GenerateGauss::Gauss1D(), General_singular_value_decomposition(), BIAS::SVD::GetLeftNullvector(), BIAS::FFT::GetMagnitude(), BIAS::CondensHisto::GetMaxValue(), BIAS::CondensHisto::GetMaxVariance(), BIAS::Random::GetMeanAndCovariance(), BIAS::CondensHisto::GetMeanVariance(), BIAS::SVD::GetNullvector(), BIAS::PMatrixLinear::GetPEstSystemInHom(), BIAS::FFT::GetPhase(), BIAS::ContourDetectorBSpline< StorageType >::GetPointAndParamVec_(), BIAS::Random::GetQuasiUniformDistributed(), GetSystem(), BIAS::Condensation::GetVariance(), BIAS::Condensation::GetWeightedVariance(), BIAS::Condensation::Init(), BIAS::LeastSquaresBase::Init(), BIAS::SparseMatrix::InvertAndSolve(), BIAS::Vector< T >::KroneckerProduct(), main(), BIAS::Matrix< T >::Mult(), BIAS::SparseMatrix::Multiply(), BIAS::Matrix< T >::MultLeft(), BIAS::MxArrToBIASVector(), MySqTransform(), BIAS::GenSynthMatches::operator=(), TNT::operator>>(), BIAS::UnVignette::PrepareLeastSquaresMin_(), BIAS::PMDImageProc::PreparePolyDepthCalibration(), BIAS::Covariance3Dto2DHomg::Project(), BIAS::Covariance3Dto2D::Project(), TNT::QR_factor(), BIAS::FilterMask::ResetFloatFilter(), BIAS::FilterMask::ResetIntFilter(), BIAS::LeastSquaresSVD::Solve(), BIAS::SparseMatrix::Solve(), BIAS::Vector< T >::Sub(), BIAS::SVD3x3::SVD3x3(), BIAS::TextureTransformDisparity::TextureTransformDisparity(), BIAS::TextureTransformDisplacement::TextureTransformDisplacement(), BIAS::TextureTransformEuclidian::TextureTransformEuclidian(), BIAS::TextureTransformRotation::TextureTransformRotation(), BIAS::TextureTransformSimilar::TextureTransformSimilar(), BIAS::Tracker< StorageType, CalculationType >::Tracker(), BIAS::MonteCarloTransform::Transform(), AffineBackTransform::Transform_(), AffineTransform::Transform_(), BIAS::CovTransformPose::Transform_(), BIAS::CovQuaternion2AxisAngle::Transform_(), BIAS::CovEuler2Quaternion::Transform_(), BIAS::Covariance3Dto2D::Transform_(), BIAS::Cov3Dto2DPoseCertain::Transform_(), BIAS::CamPoseCalib::TransformVec(), Upper_symmetric_eigenvalue_solve(), BIAS::Matrix< T >::Vec(), BIAS::Tracker< StorageType, CalculationType >::Vector2FilterMask_(), and BIAS::LeastSquaresSVD::WeightedSolve().

template<class T >
T BIAS::Vector< T >::NormL1 (  )  const [inline]

Return the L1 norm: |a| + |b| + |c| + .

..

Author:
Ingo Thomsen
Date:
04/11/2002

Definition at line 394 of file Vector.hh.

References BIAS::Vector< T >::GetData(), BIAS::Vector< T >::GetDataLast(), and T.

Referenced by BIAS::FilterMask::ComputeIntPrecisionBits().

template<class T >
double BIAS::Vector< T >::NormL2 (  )  const [inline]

template<class T = double>
bool BIAS::Vector< T >::operator!= ( const Vector< T > &  vec  )  const [inline]

Definition at line 129 of file Vector.hh.

template<class T >
const_reference TNT::Vector< T >::operator() ( Subscript  i  )  const [inline, inherited]

Definition at line 277 of file vec.h.

template<class T >
reference TNT::Vector< T >::operator() ( Subscript  i  )  [inline, inherited]

Definition at line 268 of file vec.h.

template<class T >
void BIAS::Vector< T >::operator*= ( T  scalar  )  [inline]

Definition at line 311 of file Vector.hh.

References BIAS::Vector< T >::GetData(), TNT::Vector< T >::size(), and T.

template<class T >
void BIAS::Vector< T >::operator+= ( const Vector< T > &  vec  )  [inline]

Definition at line 287 of file Vector.hh.

References BIASASSERT, BIAS::Vector< T >::GetData(), TNT::Vector< T >::size(), and T.

template<class T >
void BIAS::Vector< T >::operator-= ( const Vector< T > &  vec  )  [inline]

Definition at line 299 of file Vector.hh.

References BIASASSERT, BIAS::Vector< T >::GetData(), TNT::Vector< T >::size(), and T.

template<class T >
void BIAS::Vector< T >::operator/= ( T  scalar  )  [inline]

Author:
woelk 12/2004

Definition at line 322 of file Vector.hh.

References BIAS::Vector< T >::GetData(), BIAS::Vector< T >::Size(), TNT::Vector< T >::size(), and T.

template<class T = double>
Vector<T>& BIAS::Vector< T >::operator= ( const Vector< T > &  vec  )  [inline]

assignment operator calling corresponding operator from base class "TNT::Vector" if appropriate

Author:
grest

Definition at line 115 of file Vector.hh.

template<class T >
Vector< T > & Vector::operator= ( const TNT::Vector< T > &  vec  )  [inline]

assignment operators calling corresponding operator from base class "TNT::Vector" if appropriate

Author:
Jan Woetzel (02/25/2002)

Reimplemented from TNT::Vector< T >.

Definition at line 83 of file Vector.cpp.

Referenced by BIAS::Vector< T >::Fill().

template<class T >
bool BIAS::Vector< T >::operator== ( const Vector< T > &  vec  )  const [inline]

Definition at line 333 of file Vector.hh.

References