class HCL_VectorSpace_d : public HCL_Base

HCL_VectorSpace_d is the base class for all vector spaces in HCL

Inheritance:


Public Methods

virtual void* GetType ()
Get type of vector space for comparison
HCL_VectorSpace_d (const HCL_VectorSpace_d & x)
Copy constructor
virtual HCL_Vector_d* Member ()
Virtual constructor
virtual int operator != (const HCL_VectorSpace_d &)
Operator !=
virtual int operator == (const HCL_VectorSpace_d &)
Operator ==
virtual HCL_VectorSpace_d* Replicate ()
Virtual copy constructor
int Test ( int display = 0, double tol = 100 )
Test routine
virtual ostream& Write (ostream &)
Debugging information

Inherited from HCL_Base:

Public Methods

int Count()
void DecCount()
void IncCount()

Private Fields

int ReferenceCount

Documentation

HCL_VectorSpace_d is the base class for all vector spaces in HCL. The purpose of a vector space in HCL is two-fold.
HCL_VectorSpace_d(const HCL_VectorSpace_d & x)
Copy constructor. Each concrete class derived from HCL_VectorSpace_d should implement a copy constructor for use with Replicate.

virtual int operator == (const HCL_VectorSpace_d &)
Operator ==. This comparitor must be implemented for each concrete derived class. Note that in order to compare two vector spaces, the second space (the argument to operator==) must be cast to be the same type as the first space. In order to do this safely, the results of GetType are 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. If this is not clear, see the comparitor for HCL_RnSpace_d for a simple example. Note that these details are only important for a user who wishes to implement his own vector space. To use an existing class, one needs merely know that operator== compares two spaces for equality.

virtual int operator != (const HCL_VectorSpace_d &)
Operator !=. This comparitor must be implemented for each concrete derived class; it can be implemented using operator==.

virtual void* GetType()
Get type of vector space for comparison. GetType makes it possible to check that two vector spaces are of the same derived class before comparing them. Each derived class has a static char field called Type; GetType just returns the address of Type, cast to void*. This is a primitive form of Run Time Type Information.

virtual HCL_Vector_d* Member()
Virtual constructor. This method constructs a vector belonging to this vector space and returns a pointer to it. Note that the calling routine is responsible for deleting the vector when it is no longer needed. Member is used to create temporary vectors "abstractly", i.e. without knowing the exact type of the vector desired. See the documentation for this class (above).

virtual HCL_VectorSpace_d* Replicate()
Virtual copy constructor. This method constructs a copy of this vector space and returns a pointer to it. Since every HCL_VectorSpace_d should have a copy constructor, Replicate can just be implemented to call the copy constructor and return the the result:
       MyVectorSpace::Replicate()
       {
          return new MyVectorSpace( *this );
       }
       

int Test( int display = 0, double tol = 100 )
Test routine. Can be used by the implementor of a concrete derived class to check for coding errors. This routine checks that the axioms of a vector space hold (up to round-off errors) for random vectors. The return value is the number of errors detected. The first input is a display flag; if it is zero, no results are displayed; if it is 1, the number of errors detected is displayed; if it is greater than 1, the result of each individual test is displayed. The second input sets the tolerance for the floating-point tests; an error is reported if two results which ought to be equal differ by a relative amount greater than tol times machine epsilon.

virtual ostream& Write(ostream &)
Debugging information. Write should be implemented to print a description of the object that will be useful for debugging. If a complete description is lengthy, an implementor should consider just printing out a useful subset. This method will likely be used to send information to the screen when a error condition is encountered.


Direct child classes:
HCL_ProductVectorSpace_d
HCL_EuclideanVectorSpace_d
SGFSpace_d

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