HCL_VectorSpace_d is the base class for all vector spaces in HCL
HCL_VectorSpace_d (const HCL_VectorSpace_d & x) Constructs identical copy | |
virtual int | operator == (const HCL_VectorSpace_d &) const Returns nonzero if spaces are identical |
virtual int | operator != (const HCL_VectorSpace_d & x) const Returns nonzero if spaces differ |
virtual HCL_Vector_d* | Member () const Returns address of dynamically allocated (and uninitialized) vector in this space |
virtual HCL_VectorSpace_d* | Replicate () const Returns address of independent, identical copy of this vector space |
virtual int | Dim () const Returns the dimension of the vector space |
int | Test ( int display = 0, double tol = 100 ) const Test routine, useful for implementors of new vector classes to check for coding errors |
HCL_VectorSpace_d is the base class for all vector spaces in HCL. (In HCL, "vector space" is synonomous with "Hilbert space".) The purpose of a vector space in HCL is two-fold.
- Instead of being a set of vectors (as it should be mathematically), a HCL_VectorSpace_d is really a description of a certain type of vector. Therefore, two vectors are compatible (e.g. can be added) if they belong to the same vector space, i.e. if their descriptions are the same (note that a vector knows its space; see HCL_Vector_d).
Example:
if( x.Space() != y.Space() ) // Check whether x and y are compatible // Error condition- A HCL_VectorSpace_d knows how to construct a vector belonging to it, using the Member method. Thus, if in an algorithm one needs a temporary vector (to store an intermediate calculation, say), it can be constructed from the vector space,
without the algorithm knowing the exact type of vector involved .Example:
HCL_Vector_d * xtemp = x.Space().Member(); // Get a vector like xA HCL_VectorSpace_d returns its dimension via the Dim method.
For implementors: This class also provides a Test method, which performs a series of tests to check that the algebraic operations are implemented consistently in the corresponding HCL_Vector_d class. For example, Test verifies that addition is commutative, that the two versions of Add produce consistent results, and so on. This method is intended to be useful for implementors of new vector classes. The concrete vector classes provided with HCL have already passed.
All of the methods in this class are pure virtual, with the sole exception of operator !=.
Since GetType is declared public and pure virtual in the
base class, its value is available to other vector spaces before
the cast. The return values of GetType should be compared
for the two spaces; if they are the same, then the second space
is an object of the same class as the first. The cast can then
be done safely, and then the characteristic information about the
spaces can be compared. See the comparitor for
HCL_RnSpace_d for a simple example. [This primitive runtime
type check, the only runtime type check built into HCL, will
become obsolete in a future version incorporating the ISO
standard dynamic cast.]
void * MyVectorSpace::GetType() const {
return (void *)&Type;
}
MyVectorSpace::Replicate() {
return new MyVectorSpace( *this );
}
alphabetic index hierarchy of classes
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de