Abstract class for a UserVector. More...
#include <uservector.h>
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. |
Abstract class for a UserVector.
You need to implement the following method:
Definition at line 32 of file uservector.h.
UserVector< Type >::UserVector | ( | ) | [inline] |
virtual UserVector< Type >::~UserVector | ( | ) | [inline, virtual] |
Virtual Destructor.
Definition at line 62 of file uservector.h.
virtual Pointer<UserVector<Type> > UserVector< Type >::getemptycopy | ( | int | n | ) | const [pure virtual] |
Gives an empty UserVector of this type.
Abstract.
n | The size of the new UserVector. |
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual Pointer<UserVector<Type> > UserVector< Type >::getemptycopy | ( | ) | const [inline, virtual] |
Gives an empty UserVector of this type and dimension.
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 75 of file uservector.h.
virtual Pointer<UserVector<Type> > UserVector< Type >::getcopy | ( | ) | const [inline, virtual] |
Gives a copy of this UserVector.
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 82 of file uservector.h.
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.
block | The block-describtion. |
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 92 of file uservector.h.
virtual int UserVector< Type >::dim | ( | ) | const [pure virtual] |
The dimension.
Abstract.
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
int UserVector< Type >::size | ( | ) | const [inline] |
virtual void UserVector< Type >::resize | ( | const int | n | ) | [inline, virtual] |
Tests the new size.
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.
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!
i | The index of the element. |
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual Type UserVector< Type >::operator[] | ( | const int | i | ) | const [inline, virtual] |
Gives one element of this UserVector.
i | The index of the element. |
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 131 of file uservector.h.
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
i | The index of the element. |
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual DenseVector<Type> UserVector< Type >::operator() | ( | const UserVector< int > & | block | ) | const [inline, virtual] |
Gives a block form this UserVector as DenseVector.
block | The block structure. |
Reimplemented in DenseVector< Type >, DenseVector< double >, and DenseVector< interval< double > >.
Definition at line 149 of file uservector.h.
virtual DenseVector<Type> UserVector< Type >::operator() | ( | const int | low, | |
const int | up | |||
) | const [inline, virtual] |
Gives one part of this UserVector as DenseVector.
low | The lower index. | |
up | The upper index. |
Reimplemented in DenseVector< Type >, DenseVector< double >, DenseVector< int >, and DenseVector< interval< double > >.
Definition at line 159 of file uservector.h.
virtual void UserVector< Type >::SetElement | ( | const int | i, | |
const Type & | v | |||
) | [inline, virtual] |
Sets one element of this UserVector.
i | The index of the element. | |
v | The value to set. |
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 168 of file uservector.h.
virtual void UserVector< Type >::set_block | ( | const UserVector< Type > & | v, | |
const UserVector< int > & | block | |||
) | [inline, virtual] |
Sets one block of this UserVector.
v | The UserVector to set. | |
block | The block-describtion. |
Definition at line 176 of file uservector.h.
virtual UserVector< Type >::operator const Pointer< Type > | ( | ) | const [pure virtual] |
Cast-Operator to a const Pointer of Type.
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< interval< double > >, DenseVector< int >, DenseVector< double >, and SparseVector< double >.
virtual UserVector<Type>& UserVector< Type >::operator= | ( | const UserVector< Type > & | v | ) | [pure virtual] |
Assign-Operator for a UserVector.
Abstract.
v | The UserVector to assign to this UserVector. |
Implemented in DenseVector< Type >, SparseVector< Type >, IntervalVector, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual UserVector<Type>& UserVector< Type >::operator= | ( | const Type & | v | ) | [pure virtual] |
Assign-Operator for a value from type Type.
Abstract.
v | The value to assign to all elements of this vector. |
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual void UserVector< Type >::set | ( | const Type * | v, | |
int | n | |||
) | [inline, virtual] |
Assign-Operator for a Type*.
v | The Type*. | |
n | The length of v. |
Reimplemented in SparseVector< Type >, and SparseVector< double >.
Definition at line 203 of file uservector.h.
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().
v | The Type*. |
Reimplemented in SparseVector< Type >, and SparseVector< double >.
Definition at line 212 of file uservector.h.
virtual UserVector<Type>& UserVector< Type >::AddMult | ( | Type | a, | |
const UserVector< Type > & | v | |||
) | [inline, virtual] |
Adds a UserVector, multiplied by a Type, to this UserVector.
a | The Type to multiply v with. | |
v | The UserVector to add, after multiplication with a. |
Reimplemented in SparseVector< Type >, and SparseVector< double >.
Definition at line 219 of file uservector.h.
virtual UserVector<Type>& UserVector< Type >::operator+= | ( | const UserVector< Type > & | v | ) | [pure virtual] |
Adds a UserVector to this one.
Abstract.
v | The UserVector to add. |
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual UserVector<Type>& UserVector< Type >::operator-= | ( | const UserVector< Type > & | v | ) | [pure virtual] |
Substracts a UserVector from this one.
Abstract.
v | The UserVector to substract. |
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual UserVector<Type>& UserVector< Type >::operator*= | ( | const Type & | v | ) | [pure virtual] |
Multiplies all components with a value from type Type.
Abstract.
v | The value to multiply with. |
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual UserVector<Type>& UserVector< Type >::operator/= | ( | const Type & | v | ) | [pure virtual] |
Divides all components through a value from type Type.
Abstract.
v | The value to divide. |
Implemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
virtual bool UserVector< Type >::operator>= | ( | const Type & | v | ) | const [inline, virtual] |
Compares each element of this UserVector with a value of type Type.
v | The value to compare with. |
Reimplemented in SparseVector< Type >, and SparseVector< double >.
Definition at line 255 of file uservector.h.
virtual bool UserVector< Type >::operator== | ( | const Type & | v | ) | const [inline, virtual] |
Compares each element of this UserVector with a value of type Type.
v | The value to compare with. |
Reimplemented in SparseVector< Type >, and SparseVector< double >.
Definition at line 264 of file uservector.h.
virtual bool UserVector< Type >::operator== | ( | const UserVector< Type > & | v | ) | const [inline, virtual] |
Compares this UserVector with another one.
v | The UserVector to compare with. |
Definition at line 273 of file uservector.h.
virtual Type UserVector< Type >::operator* | ( | const UserVector< Type > & | v | ) | const [inline, virtual] |
Computes the scalar product of this UserVector and another one.
v | The UserVector to multiply with. |
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 283 of file uservector.h.
virtual DenseVector<Type> UserVector< Type >::operator* | ( | const Type & | v | ) | const [inline, virtual] |
Computes the product of this UserVector and a value from type v.
v | The value to multiply with. |
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 294 of file uservector.h.
virtual DenseVector<Type> UserVector< Type >::operator+ | ( | const UserVector< Type > & | v | ) | const [inline, virtual] |
Computes the sum of this UserVector and another UserVector.
v | The UserVector to add. |
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 313 of file uservector.h.
virtual const UserVector<Type>& UserVector< Type >::operator+ | ( | ) | const [inline, virtual] |
Computes nothing.
Reimplemented in DenseVector< Type >, DenseVector< double >, DenseVector< int >, and DenseVector< interval< double > >.
Definition at line 320 of file uservector.h.
virtual UserVector<Type>& UserVector< Type >::operator+ | ( | ) | [inline, virtual] |
virtual DenseVector<Type> UserVector< Type >::operator- | ( | const UserVector< Type > & | v | ) | const [inline, virtual] |
Computes the difference between this UserVector and another one.
v | The UserVector to substract. |
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 336 of file uservector.h.
virtual DenseVector<Type> UserVector< Type >::operator- | ( | ) | const [inline, virtual] |
Calculates this UserVector multiplied with -1.
Abstract.
Reimplemented in DenseVector< Type >, DenseVector< double >, DenseVector< int >, and DenseVector< interval< double > >.
Definition at line 344 of file uservector.h.
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.
y | The UserVector to store the result in. | |
v | The UserVector to "multiply" with. |
Definition at line 355 of file uservector.h.
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.
v | The UserVector to "multiply" with. |
Reimplemented in DenseVector< Type >, DenseVector< double >, DenseVector< int >, and DenseVector< interval< double > >.
Definition at line 366 of file uservector.h.
virtual Type UserVector< Type >::sq_norm2 | ( | ) | const [inline, virtual] |
Square of 2-Norm.
Reimplemented in SparseVector< Type >, and SparseVector< double >.
Definition at line 373 of file uservector.h.
virtual Type UserVector< Type >::dist | ( | const UserVector< Type > & | v | ) | const [inline, virtual] |
Definition at line 379 of file uservector.h.
virtual Type UserVector< Type >::mean_value | ( | ) | const [inline, virtual] |
Calculates the mean value of the elements.
Definition at line 386 of file uservector.h.
virtual Type UserVector< Type >::standard_deviation | ( | ) | const [inline, virtual] |
Calculates the standard deviation.
Definition at line 397 of file uservector.h.
void UserVector< Type >::set_random | ( | const Type | lb, | |
const Type | ub | |||
) | [inline] |
Sets this vector to random values.
lb | The lower bound of the random values. | |
ub | The upper bound of the random values. |
Definition at line 409 of file uservector.h.
void UserVector< Type >::set_random | ( | const UserVector< Type > & | low, | |
const UserVector< Type > & | up | |||
) | [inline] |
Sets this vector to random values.
low | The lower bound of the random vector. | |
up | The upper bound of the random vector. |
Definition at line 418 of file uservector.h.
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.
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.
virtual void UserVector< Type >::print | ( | ostream & | out | ) | const [inline, virtual] |
Prints this UserVector.
Prints all elements of this UserVector.
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.
ostream& operator<< | ( | ostream & | out, | |
const UserVector< Type > & | v | |||
) | [friend] |
Outputs the components of this UserVector.
Calls a.print(out).
out | An output-stream to print to. | |
v | The UserVector to print. |
Definition at line 40 of file uservector.h.
void operator>> | ( | const UserVector< Type > & | v, | |
Type * | out | |||
) | [friend] |
Definition at line 45 of file uservector.h.
istream& operator>> | ( | istream & | in, | |
UserVector< Type > & | v | |||
) | [friend] |
Definition at line 49 of file uservector.h.
DenseVector<Type> operator* | ( | const Type & | v1, | |
const UserVector< Type > & | v2 | |||
) | [friend] |
Computes the product of a value from type Type and a UserVector.
v1 | The value of type Type. | |
v2 | The UserVector to multiply with. |
Reimplemented in DenseVector< Type >, SparseVector< Type >, DenseVector< double >, DenseVector< int >, DenseVector< interval< double > >, and SparseVector< double >.
Definition at line 304 of file uservector.h.