Jive reference manual
|
Computes the scalar product of two vectors. More...
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 Class * | getClass () 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< Object > | clone () 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 Class * | getType () |
Returns the Class instance representing the Object class. More... | |
#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.
AbstractMatrix
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
.
|
protectedvirtual |
|
pure virtual |
Returns the size of this vector space.
Implemented in jive::algebra::StdVectorSpace.
|
pure virtual |
Writes the contents of the vector x to the standard output. The output format is unspecified. Use this function for debugging purposes.
x | - the vector to be printed. |
x.size() == this->size()
Implemented in jive::algebra::StdVectorSpace.
|
pure virtual |
Returns the scalar product (dot product) of the vectors x and y.
x | - a vector. |
y | - another vector. |
Implemented in jive::algebra::StdVectorSpace, and jive::algebra::MPVectorSpace.
|
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.
a | - a vector that will be filled with the scalar products. |
x | - the first input matrix. |
y | - the second input matrix. |
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 |
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.
a | - a vector that will be filled with the scalar products. |
x | - an input vector. |
y | - an input matrix. |
Reimplemented in jive::algebra::StdVectorSpace, and jive::algebra::MPVectorSpace.
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.