UserVector< Type > Class Template Reference

Abstract class for a UserVector. More...

#include <uservector.h>

Inheritance diagram for UserVector< Type >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 UserVector ()
 Standard-Constructor.
virtual ~UserVector ()
 Virtual Destructor.
virtual Pointer< UserVector
< Type > > 
getemptycopy (int n) const =0
 Gives an empty UserVector of this type.
virtual Pointer< UserVector
< Type > > 
getemptycopy () const
 Gives an empty UserVector of this type and dimension.
virtual Pointer< UserVector
< Type > > 
getcopy () const
 Gives a copy of this UserVector.
virtual Pointer< UserVector
< Type > > 
getcopy (const UserVector< int > &block) const
 Gives a Pointer to a copy of one block of this UserVector.
virtual int dim () const =0
 The dimension.
int size () const
 The size.
virtual void resize (const int n)
 Tests the new size.
virtual Type & operator[] (const int i)=0
 Gives a reference to one component of this UserVector.
virtual Type operator[] (const int i) const
 Gives one element of this UserVector.
virtual Type operator() (const int i) const =0
 Gives a copy of one component of this UserVector.
virtual DenseVector< Type > operator() (const UserVector< int > &block) const
 Gives a block form this UserVector as DenseVector.
virtual DenseVector< Type > operator() (const int low, const int up) const
 Gives one part of this UserVector as DenseVector.
virtual void SetElement (const int i, const Type &v)
 Sets one element of this UserVector.
virtual void set_block (const UserVector< Type > &v, const UserVector< int > &block)
 Sets one block of this UserVector.
virtual operator const Pointer< Type > () const =0
 Cast-Operator to a const Pointer of Type.
virtual UserVector< Type > & operator= (const UserVector< Type > &v)=0
 Assign-Operator for a UserVector.
virtual UserVector< Type > & operator= (const Type &v)=0
 Assign-Operator for a value from type Type.
virtual void set (const Type *v, int n)
 Assign-Operator for a Type*.
void set (const Type *v)
 Sets this UserVector to the values of v.
virtual UserVector< Type > & AddMult (Type a, const UserVector< Type > &v)
 Adds a UserVector, multiplied by a Type, to this UserVector.
virtual UserVector< Type > & operator+= (const UserVector< Type > &v)=0
 Adds a UserVector to this one.
virtual UserVector< Type > & operator-= (const UserVector< Type > &v)=0
 Substracts a UserVector from this one.
virtual UserVector< Type > & operator*= (const Type &v)=0
 Multiplies all components with a value from type Type.
virtual UserVector< Type > & operator/= (const Type &v)=0
 Divides all components through a value from type Type.
virtual bool operator>= (const Type &v) const
 Compares each element of this UserVector with a value of type Type.
virtual bool operator== (const Type &v) const
 Compares each element of this UserVector with a value of type Type.
virtual bool operator== (const UserVector< Type > &v) const
 Compares this UserVector with another one.
virtual Type operator* (const UserVector< Type > &v) const
 Computes the scalar product of this UserVector and another one.
virtual DenseVector< Type > operator* (const Type &v) const
 Computes the product of this UserVector and a value from type v.
virtual DenseVector< Type > operator+ (const UserVector< Type > &v) const
 Computes the sum of this UserVector and another UserVector.
virtual const UserVector< Type > & operator+ () const
 Computes nothing.
virtual UserVector< Type > & operator+ ()
 Computes nothing.
virtual DenseVector< Type > operator- (const UserVector< Type > &v) const
 Computes the difference between this UserVector and another one.
virtual DenseVector< Type > operator- () const
 Calculates this UserVector multiplied with -1.
virtual void diagmult (UserVector< Type > &y, const UserVector< Type > &v) const
 Calculates the diagonal-multiplication.
virtual DenseVector< Type > diagmult (const UserVector< Type > &v) const
 Calculates the diagonal-multiplication.
virtual Type sq_norm2 () const
 Square of 2-Norm.
virtual Type dist (const UserVector< Type > &v) const
virtual Type mean_value () const
 Calculates the mean value of the elements.
virtual Type standard_deviation () const
 Calculates the standard deviation.
void set_random (const Type lb, const Type ub)
 Sets this vector to random values.
void set_random (const UserVector< Type > &low, const UserVector< Type > &up)
 Sets this vector to random values.
void set_random (const Type lb, const Type ub, const double sparsity)
 Sets this vector to random values with a specific sparsity.
virtual void print (ostream &out) const
 Prints this UserVector.

Friends

ostream & operator<< (ostream &out, const UserVector< Type > &v)
 Outputs the components of this UserVector.
void operator>> (const UserVector< Type > &v, Type *out)
istream & operator>> (istream &in, UserVector< Type > &v)
DenseVector< Type > operator* (const Type &v1, const UserVector< Type > &v2)
 Computes the product of a value from type Type and a UserVector.

Detailed Description

template<class Type>
class UserVector< Type >

Abstract class for a UserVector.

You need to implement the following method:

Definition at line 32 of file uservector.h.


Constructor & Destructor Documentation

template<class Type>
UserVector< Type >::UserVector (  )  [inline]

Standard-Constructor.

See also:
dim()

Definition at line 58 of file uservector.h.

template<class Type>
virtual UserVector< Type >::~UserVector (  )  [inline, virtual]

Virtual Destructor.

Definition at line 62 of file uservector.h.


Member Function Documentation

template<class Type>
virtual Pointer<UserVector<Type> > UserVector< Type >::getemptycopy ( int  n  )  const [pure 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.

Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

template<class Type>
virtual Pointer<UserVector<Type> > UserVector< 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 in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 75 of file uservector.h.

template<class Type>
virtual Pointer<UserVector<Type> > UserVector< 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 in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 82 of file uservector.h.

template<class Type>
virtual Pointer<UserVector<Type> > UserVector< 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 in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 92 of file uservector.h.

template<class Type>
virtual int UserVector< Type >::dim (  )  const [pure virtual]
template<class Type>
int UserVector< Type >::size (  )  const [inline]

The size.

Returns:
The dimension.
See also:
dim()

Definition at line 108 of file uservector.h.

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

Tests the new size.

Parameters:
n The new size.

Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 113 of file uservector.h.

template<class Type>
virtual Type& UserVector< Type >::operator[] ( const int  i  )  [pure 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)

Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

template<class Type>
virtual Type UserVector< 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 in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 131 of file uservector.h.

template<class Type>
virtual Type UserVector< Type >::operator() ( const int  i  )  const [pure 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)

Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

template<class Type>
virtual DenseVector<Type> UserVector< 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 in DenseVector< Type >, DenseVector< double >, and DenseVector< interval< double > >.

Definition at line 149 of file uservector.h.

template<class Type>
virtual DenseVector<Type> UserVector< 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 in DenseVector< Type >, DenseVector< double >, DenseVector< int >, and DenseVector< interval< double > >.

Definition at line 159 of file uservector.h.

template<class Type>
virtual void UserVector< 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 in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 168 of file uservector.h.

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

Sets one block of this UserVector.

Parameters:
v The UserVector to set.
block The block-describtion.

Definition at line 176 of file uservector.h.

template<class Type>
virtual UserVector< Type >::operator const Pointer< Type > (  )  const [pure virtual]
template<class Type>
virtual UserVector<Type>& UserVector< Type >::operator= ( const UserVector< Type > &  v  )  [pure virtual]
template<class Type>
virtual UserVector<Type>& UserVector< Type >::operator= ( const Type &  v  )  [pure 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.

Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

template<class Type>
virtual void UserVector< Type >::set ( const Type *  v,
int  n 
) [inline, virtual]

Assign-Operator for a Type*.

Parameters:
v The Type*.
n The length of v.
Returns:
This UserVector.

Reimplemented in SparseVector< Type >, and SparseVector< double >.

Definition at line 203 of file uservector.h.

template<class Type>
void UserVector< Type >::set ( const Type *  v  )  [inline]

Sets this UserVector to the values of v.

Be careful with this one. v needs to have the length dim().

Parameters:
v The Type*.
Returns:
This UserVector.

Reimplemented in SparseVector< Type >, and SparseVector< double >.

Definition at line 212 of file uservector.h.

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

Adds a UserVector, multiplied by a Type, to this UserVector.

Parameters:
a The Type to multiply v with.
v The UserVector to add, after multiplication with a.
Returns:
This UserVector

Reimplemented in SparseVector< Type >, and SparseVector< double >.

Definition at line 219 of file uservector.h.

template<class Type>
virtual UserVector<Type>& UserVector< Type >::operator+= ( const UserVector< Type > &  v  )  [pure virtual]
template<class Type>
virtual UserVector<Type>& UserVector< Type >::operator-= ( const UserVector< Type > &  v  )  [pure virtual]

Substracts a UserVector from this one.

Abstract.

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

Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

template<class Type>
virtual UserVector<Type>& UserVector< Type >::operator*= ( const Type &  v  )  [pure virtual]

Multiplies all components with a value from type Type.

Abstract.

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

Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

template<class Type>
virtual UserVector<Type>& UserVector< Type >::operator/= ( const Type &  v  )  [pure virtual]

Divides all components through a value from type Type.

Abstract.

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

Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

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

Compares each element of this UserVector with a value of type Type.

Parameters:
v The value to compare with.
Returns:
True, if all elements are greater-equal v. False else.

Reimplemented in SparseVector< Type >, and SparseVector< double >.

Definition at line 255 of file uservector.h.

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

Compares each element of this UserVector with a value of type Type.

Parameters:
v The value to compare with.
Returns:
True, if all elements are equal to v. False else.

Reimplemented in SparseVector< Type >, and SparseVector< double >.

Definition at line 264 of file uservector.h.

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

Compares this UserVector with another one.

Parameters:
v The UserVector to compare with.
Returns:
True, if this UserVectors is equal to v. False else.

Definition at line 273 of file uservector.h.

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

Computes the scalar product of this UserVector and another one.

Parameters:
v The UserVector to multiply with.
Returns:
The scalar product *this * v.

Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 283 of file uservector.h.

template<class Type>
virtual DenseVector<Type> UserVector< 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 in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 294 of file uservector.h.

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

Computes the sum of this UserVector and another UserVector.

Parameters:
v The UserVector to add.
Returns:
A new DenseVector, which is the sum of this one and v.
See also:
operator+=(const UserVector<Type>&)

Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 313 of file uservector.h.

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

Computes nothing.

Returns:
This UserVector as const.

Reimplemented in DenseVector< Type >, DenseVector< double >, DenseVector< int >, and DenseVector< interval< double > >.

Definition at line 320 of file uservector.h.

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

Computes nothing.

Returns:
This UserVector.

Definition at line 327 of file uservector.h.

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

Computes the difference between this UserVector and another one.

Parameters:
v The UserVector to substract.
Returns:
The difference *this - v as a new DenseVector.
See also:
operator-=(UserVector<Type>&)

Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 336 of file uservector.h.

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

Calculates this UserVector multiplied with -1.

Abstract.

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

Reimplemented in DenseVector< Type >, DenseVector< double >, DenseVector< int >, and DenseVector< interval< double > >.

Definition at line 344 of file uservector.h.

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

Calculates the diagonal-multiplication.

Multiplies each component of this UserVector with the corresponding component of v.

This vector is not altered.

Parameters:
y The UserVector to store the result in.
v The UserVector to "multiply" with.

Definition at line 355 of file uservector.h.

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

Calculates the diagonal-multiplication.

Multiplies each component of this UserVector with the corresponding component of v.

This vector is not altered.

Parameters:
v The UserVector to "multiply" with.
Returns:
A new DenseVector, which is the diagonal-product of this one and v.

Reimplemented in DenseVector< Type >, DenseVector< double >, DenseVector< int >, and DenseVector< interval< double > >.

Definition at line 366 of file uservector.h.

template<class Type>
virtual Type UserVector< Type >::sq_norm2 (  )  const [inline, virtual]

Square of 2-Norm.

Returns:
The square of the 2-norm of this UserVector.

Reimplemented in SparseVector< Type >, and SparseVector< double >.

Definition at line 373 of file uservector.h.

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

Definition at line 379 of file uservector.h.

template<class Type>
virtual Type UserVector< Type >::mean_value (  )  const [inline, virtual]

Calculates the mean value of the elements.

Returns:
The arithmetic mean value.

Definition at line 386 of file uservector.h.

template<class Type>
virtual Type UserVector< Type >::standard_deviation (  )  const [inline, virtual]

Calculates the standard deviation.

Returns:
The standard deviation.
See also:
mean_value()

Definition at line 397 of file uservector.h.

template<class Type>
void UserVector< Type >::set_random ( const Type  lb,
const Type  ub 
) [inline]

Sets this vector to random values.

Parameters:
lb The lower bound of the random values.
ub The upper bound of the random values.

Definition at line 409 of file uservector.h.

template<class Type>
void UserVector< Type >::set_random ( const UserVector< Type > &  low,
const UserVector< Type > &  up 
) [inline]

Sets this vector to random values.

Parameters:
low The lower bound of the random vector.
up The upper bound of the random vector.

Definition at line 418 of file uservector.h.

template<class Type>
void UserVector< Type >::set_random ( const Type  lb,
const Type  ub,
const double  sparsity 
) [inline]

Sets this vector to random values with a specific sparsity.

Parameters:
lb The lower bound of the random values.
ub The upper bound of the random values.
sparsity The sparsity, between 0 and 1.

Definition at line 427 of file uservector.h.

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

Prints this UserVector.

Prints all elements of this UserVector.

Parameters:
out The ostream to print to.

Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 440 of file uservector.h.


Friends And Related Function Documentation

template<class Type>
ostream& operator<< ( ostream &  out,
const UserVector< Type > &  v 
) [friend]

Outputs the components of this UserVector.

Calls a.print(out).

Parameters:
out An output-stream to print to.
v The UserVector to print.
Returns:
The ostream out.
See also:
print(ostream&)

Definition at line 40 of file uservector.h.

template<class Type>
void operator>> ( const UserVector< Type > &  v,
Type *  out 
) [friend]

Definition at line 45 of file uservector.h.

template<class Type>
istream& operator>> ( istream &  in,
UserVector< Type > &  v 
) [friend]

Definition at line 49 of file uservector.h.

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

Computes the product of a value from type Type and a UserVector.

Parameters:
v1 The value of type Type.
v2 The UserVector to multiply with.
Returns:
A new DenseVector, which is the product of v1 and v2.
See also:
operator*(const Type&)

Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.

Definition at line 304 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