Jive reference manual
List of all members | Public Types | Public Member Functions | Public Attributes | Protected Member Functions
jive::algebra::VectorSpace Class Referenceabstract

Computes the scalar product of two vectors. More...

Inheritance diagram for jive::algebra::VectorSpace:
Inheritance graph

Public Types

typedef util::Vector Vector
 A vector type. More...
 
typedef util::Matrix Matrix
 A matrix type. More...
 

Public Member Functions

virtual int size () const =0
 Returns the size of this vector space. More...
 
virtual void print (const Vector &x) const =0
 Writes the constents of a vector to the standard output. More...
 
virtual double product (const Vector &x, const Vector &y) const =0
 Computes the scalar product of two vectors. More...
 
virtual void products (const Vector &a, const Matrix &x, const Matrix &y) const
 Computes the scalar products of multiple vectors. More...
 
virtual void project (const Vector &a, const Vector &x, const Matrix &y) const
 Computes the scalar product of a vector with several other vectors. More...
 
- Public Member Functions inherited from jem::Object
virtual ClassgetClass () const
 Returns the Class instance representing the runtime class of this object. More...
 
virtual String toString () const
 Returns a short textual description of this object. More...
 
virtual long hashValue () const
 Returns a hash value for this object. More...
 
virtual bool equals (const Ref< Object > &obj) const
 Tests whether two objects are equal. More...
 
Ref< Objectclone () const
 Returns a copy of this object. More...
 

Public Attributes

jem::util::Event< int > resizeEvent
 Signals that the size of this vector space has changed. More...
 

Protected Member Functions

virtual ~VectorSpace ()
 
- Protected Member Functions inherited from jem::Collectable
 Collectable ()
 Creates an empty Collectable. More...
 
 ~Collectable ()
 Frees resources. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from jem::Object
static ClassgetType ()
 Returns the Class instance representing the Object class. More...
 

Detailed Description

#include <jive/algebra/VectorSpace.h>

The abstract class VectorSpace provides a set of functions that compute the scalar product – or dot product – of two or more vectors. This class can be used to implement algorithms that need to ececute a series of scalar products and that do not care how the scalar products are actually computed.

The member functions of the VectorSpace class only accept vectors of a particular size. This size is called the size of a vector space.

See also
AbstractMatrix

Member Typedef Documentation

The Vector type is just an alias for jive::util::Vector (which is an alias for jem::Array<double>).

The Matrix type is just an alias for jive::util::Matrix.

Constructor & Destructor Documentation

virtual jive::algebra::VectorSpace::~VectorSpace ( )
protectedvirtual

Member Function Documentation

virtual int jive::algebra::VectorSpace::size ( ) const
pure virtual

Returns the size of this vector space.

Returns
The size of this vector space.

Implemented in jive::algebra::StdVectorSpace.

virtual void jive::algebra::VectorSpace::print ( const Vector x) const
pure virtual

Writes the contents of the vector x to the standard output. The output format is unspecified. Use this function for debugging purposes.

Parameters
x- the vector to be printed.
Precondition
x.size() == this->size()

Implemented in jive::algebra::StdVectorSpace.

virtual double jive::algebra::VectorSpace::product ( const Vector x,
const Vector y 
) const
pure virtual

Returns the scalar product (dot product) of the vectors x and y.

Parameters
x- a vector.
y- another vector.
Precondition
x.size() == this->size() &&
y.size() == this->size()
Returns
The scalar product of x and y.

Implemented in jive::algebra::StdVectorSpace, and jive::algebra::MPVectorSpace.

virtual void jive::algebra::VectorSpace::products ( const Vector a,
const Matrix x,
const Matrix y 
) const
virtual

Computes the scalar products of the columns of the matrices x and y. The products are stored in the vector a. To be precise, a[i] is set to the scalar product of the i-th columns of the matrices x and y.

The implementation of this function provoded by the VectorSpace class repeatedly calls the member function product(). Derived classes are encouraged to provide a more efficient implementation.

Parameters
a- a vector that will be filled with the scalar products.
x- the first input matrix.
y- the second input matrix.
Precondition
a.size() == x.size(1) &&
x.size(0) == this->size() &&
y.size(0) == this->size() &&
y.size(1) == x.size(1)

Reimplemented in jive::algebra::StdVectorSpace, and jive::algebra::MPVectorSpace.

virtual void jive::algebra::VectorSpace::project ( const Vector a,
const Vector x,
const Matrix y 
) const
virtual

Fills the vector a with the scalar products of the vector x with the columns of the matrix y. That is, a[i] is set to the scalar product of x with the i-th column of y. If the size of the vector a is larger than n, with n the number of columns in the matrix y, then a[n] is set to the scalar product of the vector x with itself. This behavior is particularly handy when implementing algorithms that involve an orthogonalization procedure.

The implementation of this function provoded by the VectorSpace class repeatedly calls the member function product(). Derived classes are encouraged to provide a more efficient implementation.

Parameters
a- a vector that will be filled with the scalar products.
x- an input vector.
y- an input matrix.
Precondition
a.size() == y.size(1) &&
x.size() == this->size() &&
y.size(0) == this->size()

Reimplemented in jive::algebra::StdVectorSpace, and jive::algebra::MPVectorSpace.

Member Data Documentation

jem::util::Event<int> jive::algebra::VectorSpace::resizeEvent

The resizeEvent is emitted whenever the size of this vector space has been changed. The argument of the event is the new size of this vector space.