Concept Vector. More...

#include <gvector.h>

Inheritance diagram for GVector:
[legend]

List of all members.

Public Member Functions

 GVector (GConcept *metaconcept)
 GVector (GConcept *metaconcept, size_t max)
 GVector (const GVector &vector)
int Compare (const GVector &vector) const
int Compare (const GConcept &metaconcept) const
int Compare (const GConcept *metaconcept) const
R::RCursor< GConceptRefGetRefs (void) const
GConceptGetMetaConcept (void) const
size_t GetMetaConceptId (void) const
GConceptRefGetRef (const GConceptRef *ref)
GConceptRefGetRef (GConcept *concept)
void InsertRef (GConceptRef *ref)
void DeleteRef (GConceptRef *ref)
void DeleteRef (const GConcept *concept)
bool IsIn (const GConcept *concept) const
size_t GetTab (const GConceptRef **tab) const
void Clear (size_t size=0)
size_t GetNb (void) const
bool IsDefined (void) const
double GetMaxWeight (void) const
double GetMaxAbsWeight (void) const
void Extract (GVector &vector, const GConceptType *type)
void ComputeTfIdf (tObjType ObjType)
void Print (R::RString msg)
void Intersection (const GVector &vector)
GVectoroperator= (const GVector &vector)
GVectoroperator+= (const GVector &vector)
GVectoroperator-= (const GVector &vector)
GVectoroperator*= (const double nb)
GVectoroperator/= (const double nb)
virtual ~GVector (void)

Static Public Member Functions

static int SortOrder (const void *a, const void *b)

Protected Member Functions

void Copy (const R::RContainer< GConceptRef, false, true > &vector)

Detailed Description

Concept Vector.

The GVector provides a representation for a (sparse) vector of concept references associated with a given meta-concept. Each element of the vector is represented by a GConceptRef class.

In practice, several vectors are used to describe the object (document, profile, community or class) in the tensor space model.

Author:
Pascal Francq

Constructor & Destructor Documentation

GVector ( GConcept metaconcept)

Constructor of a vector.

Parameters:
metaconceptMeta-concept associated with the vector.
GVector ( GConcept metaconcept,
size_t  max 
)

Constructor of a vector.

Parameters:
metaconceptMeta-concept associated with the vector.
maxInitial number of maximal references.
GVector ( const GVector vector)

Copy constructor of a vector.

Parameters:
vectorVector.
virtual ~GVector ( void  ) [virtual]

Destruct the vector.


Member Function Documentation

static int SortOrder ( const void *  a,
const void *  b 
) [static]

Static function used to order the concept weights.

Parameters:
aPointer to the first object.
bPointer to the second object.

Reimplemented from RContainer< GConceptRef, true, true >.

void Copy ( const R::RContainer< GConceptRef, false, true > &  vector) [protected]

Copy method for the vectors.

Parameters:
vectorSource vector.
int Compare ( const GVector vector) const

Compare two vectors using to their meta-concept.

See also:
R::RContainer
Parameters:
vectorVector.
Returns:
int
int Compare ( const GConcept metaconcept) const

Compare a vector and a meta-concept.

See also:
R::RContainer
Parameters:
metaconceptMeta-concept.
Returns:
int
int Compare ( const GConcept metaconcept) const

Compare a vector and a meta-concept.

See also:
R::RContainer
Parameters:
metaconceptMeta-concept.
Returns:
int
R::RCursor<GConceptRef> GetRefs ( void  ) const

Get a cursor on the concept references.

Returns:
a cursor of GConceptRef.
GConcept* GetMetaConcept ( void  ) const

Get the meta-concept associated with the vector.

Returns:
a pointer to a GConcept.
size_t GetMetaConceptId ( void  ) const
Returns:
the meta-concept identifier associated with the vector.
GConceptRef* GetRef ( const GConceptRef ref)

Get a concept reference based on a given one. If it is not found, it is created with a null weight.

Parameters:
refConcept reference.
Returns:
a pointer to a GConceptRef.
GConceptRef* GetRef ( GConcept concept)

Get a pointer to a concept reference based on a given concept. If it is not found, it is created with a null weight.

Parameters:
conceptConcept.
Returns:
a pointer to a GConceptRef.
void InsertRef ( GConceptRef ref)

Insert a concept reference.

Parameters:
refConcept reference.
void DeleteRef ( GConceptRef ref)

Delete a concept reference.

Parameters:
refConcept reference.
void DeleteRef ( const GConcept concept)

Delete an reference to a given concept.

Parameters:
conceptConcept.
bool IsIn ( const GConcept concept) const

Verify if a given concept is in the vector.

Parameters:
conceptConcept.
Returns:
true if the concept is contained.
size_t GetTab ( const GConceptRef **  tab) const

Fill an array with the concept references.

Parameters:
tabArray to fill.
Returns:
the number of elements copied.
void Clear ( size_t  size = 0)

Clear the vector and extend it if necessary.

Parameters:
sizeExpected size of the vector.
size_t GetNb ( void  ) const
Returns:
the number of elements in the container.

Reimplemented from RContainer< GConceptRef, true, true >.

bool IsDefined ( void  ) const

Verifies if the vector is defined, i.e. if it has at least one element.

Returns:
true if the vector is defined.
double GetMaxWeight ( void  ) const

Compute the maximal weight of the concept references in the vector.

Returns:
double.
double GetMaxAbsWeight ( void  ) const

Compute the maximal absolute weight of the concept references in the vector.

Returns:
double.
void Extract ( GVector vector,
const GConceptType type 
)

Extract all concepts related to a given type an put them into a given vector that will be emptied.

Parameters:
vectorDestination vectors.
typeType selected.
void ComputeTfIdf ( tObjType  ObjType)

Compute the Tf*Idf weights for all the elements of the vector.

Parameters:
ObjTypeType of the reference (documents, profiles, etc.).
void Print ( R::RString  msg)

Print the vector to the standard output.

Parameters:
msgHeader message.
void Intersection ( const GVector vector)

Build the intersection two vectors. In practice, the weight of the concept references in both vectors are added, the rest is deleted.

Parameters:
vectorVector to search for the intersection.
Warning:
Only vectors associated with the same meta-concept can be compared.
GVector& operator= ( const GVector vector)

Assignment operator for the vectors.

Parameters:
vectorVector to assign.
GVector& operator+= ( const GVector vector)

Addition operator for the vectors.

Parameters:
vectorVector to add.
Warning:
Only vectors associated with the same meta-concept can be added.
GVector& operator-= ( const GVector vector)

Subtraction operator for the vectors.

Parameters:
vectorVector to subtract.
Warning:
Only vectors associated with the same meta-concept can be subtracted.
GVector& operator*= ( const double  nb)

Multiplication operator for the vectors.

Parameters:
nbNumber to multiply by.
GVector& operator/= ( const double  nb)

Division operator for the vectors.

Parameters:
nbNumber to multiply by.