DenseVector< Type > Class Template Reference

Wrapper-class for a dense TNT-Vector. More...

#include <uservector.h>

Inheritance diagram for DenseVector< Type >:
Inheritance graph
[legend]
Collaboration diagram for DenseVector< Type >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DenseVector (int n=0, const Type &v=Type())
 (Standard-)Constructor for optional dimension and initial value.
 DenseVector (const DenseVector< Type > &v)
 Copy-Constructor for a DenseVector.
 DenseVector (const UserVector< Type > &v)
 Copy-Constructor for a UserVector.
 DenseVector (const UserVector< Type > &v, const int low, const int up)
 Constructor for a part of a UserVector.
 DenseVector (const UserVector< Type > &v, const UserVector< int > &block)
 Constructor for a block of a UserVector.
 DenseVector (const vector< DenseVector< Type > * > &v, const vector< DenseVector< int > > &block)
 Constructor for a vector of pointer of UserVectors and a block-structure.
 DenseVector (const vector< Pointer< UserVector< Type > > > &v, const vector< DenseVector< int > > &block)
 DenseVector (const vector< Pointer< DenseVector< Type > > > &v, const vector< DenseVector< int > > &block)
 DenseVector (const vector< DenseVector< Type > > &v, const vector< DenseVector< int > > &block)
 Constructor for a vector of UserVectors and a block-structure.
 DenseVector (const Type *v, const int n)
 Constructor for an array of Type's.
 DenseVector (const TNT::Vector< Type > &x_)
 Copy-Constructor for a TNT-Vector.
Pointer< UserVector< Type > > getemptycopy (int n) const
 Gives an empty UserVector of this type.
Pointer< UserVector< Type > > getemptycopy () const
 Gives an empty UserVector of this type and dimension.
Pointer< UserVector< Type > > getcopy () const
 Gives a copy of this UserVector.
Pointer< UserVector< Type > > getcopy (const UserVector< int > &block) const
 Gives a Pointer to a copy of one block of this UserVector.
int dim () const
 The dimension.
void resize (const int n)
 Tests the new size.
Type & operator[] (const int i)
 Gives a reference to one component of this UserVector.
Type operator[] (const int i) const
 Gives one element of this UserVector.
Type operator() (const int i) const
 Gives a copy of one component of this UserVector.
void SetElement (const int i, const Type &v)
 Sets one element of this UserVector.
DenseVector< Type > operator() (const UserVector< int > &block) const
 Gives a block form this UserVector as DenseVector.
DenseVector< Type > operator() (const int low, const int up) const
 Gives one part of this UserVector as DenseVector.
DenseVector< Type > & operator= (const DenseVector< Type > &v)
 Assign-Operator for a DenseVector.
DenseVector< Type > & operator= (const UserVector< Type > &v)
DenseVector< Type > & operator= (const Type &v)
 Assign-Operator for a value from type Type.
virtual UserVector< Type > & AddMult (Type a, const UserVector< Type > &v)
DenseVector< Type > & operator+= (const DenseVector< Type > &v)
 Adds a DenseVector to this one.
DenseVector< Type > & operator+= (const UserVector< Type > &v)
DenseVector< Type > & operator-= (const DenseVector< Type > &v)
 Substract a DenseVector from this one.
DenseVector< Type > & operator-= (const UserVector< Type > &v)
DenseVector< Type > & operator*= (const Type &v)
 Multiplies all components with a value from type Type.
DenseVector< Type > & operator/= (const Type &v)
 Divides all components through a value from type Type.
DenseVector< Type > operator* (const Type &v) const
 Computes the product of this UserVector and a value from type v.
Type operator* (const DenseVector< Type > &v) const
 Computes the scalar product with a DenseVector.
DenseVector< Type > operator+ (const DenseVector< Type > &v) const
 Computes the sum of this DenseVector and another one.
DenseVector< Type > operator+ (const UserVector< Type > &v) const
const UserVector< Type > & operator+ () const
 Computes nothing.
DenseVector< Type > operator- (const DenseVector< Type > &v) const
 Computes the difference between this DenseVector and another one.
DenseVector< Type > operator- (const UserVector< Type > &v) const
DenseVector< Type > operator- () const
 Calculates this UserVector multiplied with -1.
DenseVector< Type > diagmult (const DenseVector< Type > &v) const
 Computes the diagonal multiplication of with another DenseVector.
DenseVector< Type > diagmult (const UserVector< Type > &v) const
 operator const Pointer< Type > () const
 Returns a const Pointer to the elements of this DenseVector.
void print (ostream &out) const
 Returns a Pointer to the elements of this DenseVector.

Static Public Member Functions

static Pointer< DenseVector
< Type > > 
random (const int n, const Type lb, const Type ub)
 Gives a random DenseVector.
static Pointer< DenseVector
< Type > > 
random (const int n, const Type lb, const Type ub, const double sparsity)
 Gives a random DenseVector with specified sparsity.
static Pointer< DenseVector
< Type > > 
random (const DenseVector< Type > low, const DenseVector< Type > up)
 Gives a random DenseVector.

Protected Attributes

TNT::Vector< Type > x
 The TNT-vector to wrap.

Friends

DenseVector< Type > operator* (const Type &v1, const DenseVector< Type > &v2)
 Compute the product of a Type and a DenseVector.

Detailed Description

template<class Type>
class DenseVector< Type >

Wrapper-class for a dense TNT-Vector.

Definition at line 450 of file uservector.h.


Constructor & Destructor Documentation

template<class Type>
DenseVector< Type >::DenseVector ( int  n = 0,
const Type &  v = Type() 
) [inline]

(Standard-)Constructor for optional dimension and initial value.

Parameters:
n The dimension, default is 0.
v Initial value, default is Type().

Definition at line 495 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const DenseVector< Type > &  v  )  [inline]

Copy-Constructor for a DenseVector.

Parameters:
v The DenseVector to copy.

Definition at line 502 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const UserVector< Type > &  v  )  [inline]

Copy-Constructor for a UserVector.

Parameters:
v The UserVector to copy.

Definition at line 509 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const UserVector< Type > &  v,
const int  low,
const int  up 
) [inline]

Constructor for a part of a UserVector.

Constructs DenseVector v[low]...v[up].

Parameters:
v The UserVector, the elements should be taken from.
low The lower index of the elements.
up The upper index of the elements.

Definition at line 520 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const UserVector< Type > &  v,
const UserVector< int > &  block 
) [inline]

Constructor for a block of a UserVector.

Parameters:
v The UserVector, a block should be taken from.
block The block description.

Definition at line 529 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const vector< DenseVector< Type > * > &  v,
const vector< DenseVector< int > > &  block 
) [inline]

Constructor for a vector of pointer of UserVectors and a block-structure.

Parameters:
v The vector of pointer of UserVectors.
block The block-structure.

Definition at line 538 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const vector< Pointer< UserVector< Type > > > &  v,
const vector< DenseVector< int > > &  block 
) [inline]

Definition at line 545 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const vector< Pointer< DenseVector< Type > > > &  v,
const vector< DenseVector< int > > &  block 
) [inline]

Definition at line 552 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const vector< DenseVector< Type > > &  v,
const vector< DenseVector< int > > &  block 
) [inline]

Constructor for a vector of UserVectors and a block-structure.

Parameters:
v The vector of UserVectors.
block The block-structure.

Definition at line 563 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const Type *  v,
const int  n 
) [inline]

Constructor for an array of Type's.

Parameters:
v The array of Type's.
n The length of this array.

Definition at line 574 of file uservector.h.

template<class Type>
DenseVector< Type >::DenseVector ( const TNT::Vector< Type > &  x_  )  [inline]

Copy-Constructor for a TNT-Vector.

Parameters:
x_ The TNT-Vector to copy.

Definition at line 581 of file uservector.h.


Member Function Documentation

template<class Type>
static Pointer<DenseVector<Type> > DenseVector< Type >::random ( const int  n,
const Type  lb,
const Type  ub 
) [inline, static]

Gives a random DenseVector.

Parameters:
n The dimension.
lb The lower bound.
ub The upper bound.

Definition at line 457 of file uservector.h.

template<class Type>
static Pointer<DenseVector<Type> > DenseVector< Type >::random ( const int  n,
const Type  lb,
const Type  ub,
const double  sparsity 
) [inline, static]

Gives a random DenseVector with specified sparsity.

Parameters:
n The random DenseVector.
lb The lower bound.
ub The upper bound.
sparsity The sparsity, between 0 and 1.

Definition at line 469 of file uservector.h.

template<class Type>
static Pointer<DenseVector<Type> > DenseVector< Type >::random ( const DenseVector< Type >  low,
const DenseVector< Type >  up 
) [inline, static]

Gives a random DenseVector.

Parameters:
low The lower bound.
up The upper bound.

Definition at line 479 of file uservector.h.

template<class Type>
Pointer<UserVector<Type> > DenseVector< Type >::getemptycopy ( int  n  )  const [inline, virtual]

Gives an empty UserVector of this type.

Abstract.

Parameters:
n The size of the new UserVector.
Returns:
A Pointer to a new UserVector with size n.

Implements UserVector< Type >.

Definition at line 585 of file uservector.h.

template<class Type>
Pointer<UserVector<Type> > DenseVector< Type >::getemptycopy (  )  const [inline, virtual]

Gives an empty UserVector of this type and dimension.

Returns:
A Pointer to a new UserVector with the size of this one.
See also:
getemptycopy(int)

Reimplemented from UserVector< Type >.

Definition at line 589 of file uservector.h.

template<class Type>
Pointer<UserVector<Type> > DenseVector< Type >::getcopy (  )  const [inline, virtual]

Gives a copy of this UserVector.

Returns:
A Pointer to a new UserVector, which is a copy of this one.

Reimplemented from UserVector< Type >.

Definition at line 593 of file uservector.h.

template<class Type>
Pointer<UserVector<Type> > DenseVector< Type >::getcopy ( const UserVector< int > &  block  )  const [inline, virtual]

Gives a Pointer to a copy of one block of this UserVector.

Parameters:
block The block-describtion.
Returns:
A Pointer to a copy of the block, described in block.

Reimplemented from UserVector< Type >.

Definition at line 597 of file uservector.h.

template<class Type>
int DenseVector< Type >::dim (  )  const [inline, virtual]

The dimension.

Abstract.

Returns:
The dimension of this UserVector.

Implements UserVector< Type >.

Definition at line 601 of file uservector.h.

template<class Type>
void DenseVector< Type >::resize ( const int  n  )  [inline, virtual]

Tests the new size.

Parameters:
n The new size.

Reimplemented from UserVector< Type >.

Definition at line 605 of file uservector.h.

template<class Type>
Type& DenseVector< Type >::operator[] ( const int  i  )  [inline, virtual]

Gives a reference to one component of this UserVector.

Abstract. Use operator(int), when you want to read a component only!

Parameters:
i The index of the element.
Returns:
A reference to the component at the i-th index.
See also:
operator[](const int)

Implements UserVector< Type >.

Definition at line 614 of file uservector.h.

template<class Type>
Type DenseVector< Type >::operator[] ( const int  i  )  const [inline, virtual]

Gives one element of this UserVector.

Parameters:
i The index of the element.
Returns:
The element at index i, not a reference to it.
See also:
operator[](int)

Reimplemented from UserVector< Type >.

Definition at line 618 of file uservector.h.

template<class Type>
Type DenseVector< Type >::operator() ( const int  i  )  const [inline, virtual]

Gives a copy of one component of this UserVector.

Use this one, when you want to read a component only! Abstract

Parameters:
i The index of the element.
Returns:
A copy of the the component at the i-th index.
See also:
operator[](const int)

Implements UserVector< Type >.

Definition at line 622 of file uservector.h.

template<class Type>
void DenseVector< Type >::SetElement ( const int  i,
const Type &  v 
) [inline, virtual]

Sets one element of this UserVector.

Parameters:
i The index of the element.
v The value to set.
See also:
operator[](const int i)

Reimplemented from UserVector< Type >.

Definition at line 626 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::operator() ( const UserVector< int > &  block  )  const [inline, virtual]

Gives a block form this UserVector as DenseVector.

Parameters:
block The block structure.
Returns:
The block of this UserVector, which was described in block.
See also:
DenseVector<Type>::DenseVector(const UserVector<Type>&, UserVector<int>&)

Reimplemented from UserVector< Type >.

Definition at line 630 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::operator() ( const int  low,
const int  up 
) const [inline, virtual]

Gives one part of this UserVector as DenseVector.

Parameters:
low The lower index.
up The upper index.
Returns:
The elements low to up as new UserVector.
See also:
DenseVector<Type>::DenseVector(const UserVector<Type>&, const int, const up)

Reimplemented from UserVector< Type >.

Definition at line 634 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator= ( const DenseVector< Type > &  v  )  [inline, virtual]

Assign-Operator for a DenseVector.

Parameters:
v The DenseVector to assign to this one.
Returns:
This DenseVector.

Implements UserVector< Type >.

Reimplemented in IntervalVector.

Definition at line 642 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator= ( const UserVector< Type > &  v  )  [inline]

Definition at line 647 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator= ( const Type &  v  )  [inline, virtual]

Assign-Operator for a value from type Type.

Abstract.

Parameters:
v The value to assign to all elements of this vector.
Returns:
This UserVector.

Implements UserVector< Type >.

Definition at line 653 of file uservector.h.

template<class Type>
virtual UserVector<Type>& DenseVector< Type >::AddMult ( Type  a,
const UserVector< Type > &  v 
) [inline, virtual]

Definition at line 658 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator+= ( const DenseVector< Type > &  v  )  [inline, virtual]

Adds a DenseVector to this one.

Parameters:
v The DenseVector to add.
Returns:
This DenseVector.

Implements UserVector< Type >.

Definition at line 668 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator+= ( const UserVector< Type > &  v  )  [inline]

Definition at line 673 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator-= ( const DenseVector< Type > &  v  )  [inline, virtual]

Substract a DenseVector from this one.

Parameters:
v The DenseVector to substract.
Returns:
This DenseVector.

Implements UserVector< Type >.

Definition at line 683 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator-= ( const UserVector< Type > &  v  )  [inline]

Definition at line 688 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator*= ( const Type &  v  )  [inline, virtual]

Multiplies all components with a value from type Type.

Abstract.

Parameters:
v The value to multiply with.
Returns:
This UserVector.

Implements UserVector< Type >.

Definition at line 694 of file uservector.h.

template<class Type>
DenseVector<Type>& DenseVector< Type >::operator/= ( const Type &  v  )  [inline, virtual]

Divides all components through a value from type Type.

Abstract.

Parameters:
v The value to divide.
Returns:
This UserVector.

Implements UserVector< Type >.

Definition at line 699 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::operator* ( const Type &  v  )  const [inline, virtual]

Computes the product of this UserVector and a value from type v.

Parameters:
v The value to multiply with.
Returns:
A new DenseVector, which is this one multiplied by v.

Reimplemented from UserVector< Type >.

Definition at line 704 of file uservector.h.

template<class Type>
Type DenseVector< Type >::operator* ( const DenseVector< Type > &  v  )  const [inline, virtual]

Computes the scalar product with a DenseVector.

Parameters:
v The DenseVector to multiply with.
The scalar-product x * v.x.

Reimplemented from UserVector< Type >.

Definition at line 724 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::operator+ ( const DenseVector< Type > &  v  )  const [inline, virtual]

Computes the sum of this DenseVector and another one.

Parameters:
v The DenseVector to add with this one.
Returns:
The sum x + v.x as DenseVector.

Reimplemented from UserVector< Type >.

Definition at line 733 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::operator+ ( const UserVector< Type > &  v  )  const [inline]

Definition at line 737 of file uservector.h.

template<class Type>
const UserVector<Type>& DenseVector< Type >::operator+ (  )  const [inline, virtual]

Computes nothing.

Returns:
This UserVector as const.

Reimplemented from UserVector< Type >.

Definition at line 742 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::operator- ( const DenseVector< Type > &  v  )  const [inline, virtual]

Computes the difference between this DenseVector and another one.

Parameters:
v The DenseVector to subtract.
Returns:
The difference x - v.x as DenseVector.

Reimplemented from UserVector< Type >.

Definition at line 751 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::operator- ( const UserVector< Type > &  v  )  const [inline]

Definition at line 755 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::operator- (  )  const [inline, virtual]

Calculates this UserVector multiplied with -1.

Abstract.

Returns:
A new DenseVector, which is this one, multiplied by -1.

Reimplemented from UserVector< Type >.

Definition at line 760 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::diagmult ( const DenseVector< Type > &  v  )  const [inline, virtual]

Computes the diagonal multiplication of with another DenseVector.

Parameters:
v The DenseVector to multiply diagonaly with.
Returns:
The diagonal product as DenseVector.

Reimplemented from UserVector< Type >.

Definition at line 770 of file uservector.h.

template<class Type>
DenseVector<Type> DenseVector< Type >::diagmult ( const UserVector< Type > &  v  )  const [inline]

Definition at line 774 of file uservector.h.

template<class Type>
DenseVector< Type >::operator const Pointer< Type > (  )  const [inline, virtual]

Returns a const Pointer to the elements of this DenseVector.

Implements UserVector< Type >.

Definition at line 783 of file uservector.h.

template<class Type>
void DenseVector< Type >::print ( ostream &  out  )  const [inline, virtual]

Returns a Pointer to the elements of this DenseVector.

Prints this DenseVector. Prints each element, seperated by space and finished with a new line.

Parameters:
out The ostream to print to.

Reimplemented from UserVector< Type >.

Definition at line 797 of file uservector.h.


Friends And Related Function Documentation

template<class Type>
DenseVector<Type> operator* ( const Type &  v1,
const DenseVector< Type > &  v2 
) [friend]

Compute the product of a Type and a DenseVector.

Parameters:
v1 The first factor as Type.
v2 The secont factor as DenseVector.
Returns:
A DenseVector, which is the product v1 * v2.
See also:
operator*(const Type&)

Reimplemented from UserVector< Type >.

Definition at line 716 of file uservector.h.


Member Data Documentation

template<class Type>
TNT::Vector<Type> DenseVector< Type >::x [protected]

The TNT-vector to wrap.

Definition at line 488 of file uservector.h.


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

Generated on 10 Mar 2013 for LaGO by  doxygen 1.6.1