Concept Vector. More...
#include <gvector.h>
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::RConstCursor< GConceptRef > | GetRefs (void) const |
R::RCursor< GConceptRef > | GetRefs (void) |
GConcept * | GetMetaConcept (void) const |
size_t | GetMetaConceptId (void) const |
const GConceptRef * | GetRef (GConceptRef *ref) const |
GConceptRef * | GetRef (GConceptRef *ref) |
const GConceptRef * | GetRef (GConcept *concept) const |
GConceptRef * | GetRef (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 |
double | GetSumWeights (void) const |
double | GetSumAbsWeights (void) const |
void | Extract (GVector &vector, const GConceptType *type) |
template<class S > | |
void | Print (S &stream, const R::RString &name, const char *format="%E", size_t colsize=12) const |
void | Intersection (const GVector &vector) |
GVector & | operator= (const GVector &vector) |
GVector & | operator+= (const GVector &vector) |
GVector & | operator-= (const GVector &vector) |
GVector & | operator*= (const double nb) |
GVector & | operator/= (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) |
Private Member Functions | |
void | AnalyzeWeights (void) const |
Private Member Functions inherited from RContainer< GConceptRef, true, true > | |
RContainer (size_t m, size_t i=0) | |
RContainer (const RContainer< GConceptRef, true, true > &src) | |
RContainer (const RContainer< GConceptRef, false, true > &src) | |
int | Compare (const RContainer< GConceptRef, true, true > &) const |
size_t | GetNb (void) const |
size_t | GetMaxPos (void) const |
size_t | GetMaxNb (void) const |
size_t | GetIncNb (void) const |
bool | VerifyIndex (size_t idx) const |
void | VerifyTab (size_t max=0) |
void | Clear (size_t m=0, size_t i=0, bool force=false) |
void | ReOrder (int sortOrder(const void *, const void *), size_t min, size_t max) |
void | ReOrder (int sortOrder(const void *, const void *)) |
void | ReOrder (void) |
void | Exchange (size_t pos1, size_t pos2) |
void | Shift (size_t idx, bool reverse) |
void | Transfer (RContainer< GConceptRef, a, o > &src) |
RContainer & | operator= (const RContainer< GConceptRef, true, true > &src) |
RContainer & | operator= (const RContainer< GConceptRef, false, true > &src) |
void | Copy (const RContainer< GConceptRef, a, true > &src) |
RContainer & | operator+= (const RContainer< GConceptRef, a, o > &src) |
size_t | GetIndex (const TUse &tag, bool &find, size_t min=0, size_t max=0) const |
bool | IsIn (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const |
bool | IsIn (const TUse &tag, size_t min=0, size_t max=0) const |
const GConceptRef * | operator[] (size_t idx) const |
GConceptRef * | operator[] (size_t idx) |
const GConceptRef * | GetPtrAt (size_t idx) const |
GConceptRef * | GetPtrAt (size_t idx) |
GConceptRef * | GetPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const |
GConceptRef * | GetPtr (const TUse &tag, size_t min=0, size_t max=0) const |
GConceptRef * | GetInsertPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) |
GConceptRef * | GetInsertPtr (const TUse &tag, size_t min=0, size_t max=0) |
GConceptRef * | GetInsertPtrAt (const TUse &tag, size_t pos) |
RContainer< GConceptRef, false, true > * | GetPtrs (const TUse &tag, size_t min=0, size_t max=0) const |
size_t | GetTab (const void **tab, size_t min=0, size_t max=0) const |
size_t | GetTab (void **tab, size_t min=0, size_t max=0) |
size_t | GetTab (const GConceptRef **tab, size_t min=0, size_t max=0) const |
size_t | GetTab (GConceptRef **tab, size_t min=0, size_t max=0) |
void | InsertPtrAt (GConceptRef *ins, size_t pos, bool del) |
void | InsertPtrAt (GConceptRef *ins, size_t pos) |
void | InsertPtr (GConceptRef *ins, bool del=false, size_t min=0, size_t max=0) |
void | DeletePtrAt (size_t pos, bool shift, bool del) |
void | DeletePtrAt (size_t pos, bool shift) |
void | DeletePtrAt (size_t pos) |
void | DeletePtr (const TUse &tag, bool sortkey, bool del, size_t min=0, size_t max=0) |
void | DeletePtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) |
void | DeletePtr (const TUse &tag, size_t min=0, size_t max=0) |
void | Inter (const iRContainer< GConceptRef > &src1, const iRContainer< GConceptRef > &src2) |
void | Union (const iRContainer< GConceptRef > &src1, const iRContainer< GConceptRef > &src2) |
virtual | ~RContainer (void) |
Private Member Functions inherited from iRContainer< C > | |
size_t | GetNb (void) const |
size_t | GetMaxPos (void) const |
size_t | GetMaxNb (void) const |
size_t | GetIncNb (void) const |
bool | VerifyIndex (size_t idx) const |
void | VerifyTab (size_t max=0) |
void | Clear (size_t m=0, size_t i=0, bool force=false) |
void | ReOrder (int sortOrder(const void *, const void *), size_t min, size_t max) |
void | ReOrder (int sortOrder(const void *, const void *)) |
void | ReOrder (void) |
void | Exchange (size_t pos1, size_t pos2) |
void | Shift (size_t idx, bool reverse) |
void | Transfer (iRContainer< C > &src) |
iRContainer & | operator= (const iRContainer< C > &src) |
void | Copy (const iRContainer< C > &src) |
iRContainer & | operator+= (const iRContainer< C > &src) |
size_t | GetIndex (bool order, const TUse &tag, bool &find, size_t min=0, size_t max=0) const |
size_t | GetIndex (const TUse &tag, bool &find, size_t min=0, size_t max=0) const |
bool | IsIn (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const |
bool | IsIn (const TUse &tag, size_t min=0, size_t max=0) const |
const C * | operator[] (size_t idx) const |
C * | operator[] (size_t idx) |
const C * | GetPtrAt (size_t idx) const |
C * | GetPtrAt (size_t idx) |
C * | GetPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) const |
C * | GetPtr (const TUse &tag, size_t min=0, size_t max=0) const |
C * | GetInsertPtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) |
C * | GetInsertPtr (const TUse &tag, size_t min=0, size_t max=0) |
C * | GetInsertPtrAt (const TUse &tag, size_t pos) |
size_t | GetTab (const void **tab, size_t min=0, size_t max=0) const |
size_t | GetTab (void **tab, size_t min=0, size_t max=0) |
size_t | GetTab (const C **tab, size_t min=0, size_t max=0) const |
size_t | GetTab (C **tab, size_t min=0, size_t max=0) |
void | InsertPtrAt (C *ins, size_t pos, bool del) |
void | InsertPtrAt (C *ins, size_t pos) |
void | InsertPtr (C *ins, bool del=false, size_t min=0, size_t max=0) |
void | DeletePtrAt (size_t pos, bool shift, bool del) |
void | DeletePtrAt (size_t pos, bool shift) |
void | DeletePtrAt (size_t pos) |
void | DeletePtr (const TUse &tag, bool sortkey, bool del, size_t min=0, size_t max=0) |
void | DeletePtr (const TUse &tag, bool sortkey, size_t min=0, size_t max=0) |
void | DeletePtr (const TUse &tag, size_t min=0, size_t max=0) |
void | Inter (const iRContainer< C > &src1, const iRContainer< C > &src2) |
void | Union (const iRContainer< C > &src1, const iRContainer< C > &src2) |
virtual | ~iRContainer (void) |
void | Create (const iRContainer< C > &src) |
iRContainer & | NormalCopy (const iRContainer< C > &src) |
void | DeepCopy (const iRContainer< C > &src) |
iRContainer & | Add (const iRContainer< C > &src) |
Private Attributes | |
GConcept * | MetaConcept |
double | MaxWeight |
double | MaxAbsWeight |
Private Attributes inherited from iRContainer< C > | |
C ** | Tab |
size_t | NbPtr |
size_t | MaxPtr |
size_t | LastPtr |
size_t | IncPtr |
Additional Inherited Members | |
Static Private Member Functions inherited from RContainer< GConceptRef, true, true > | |
static int | SortOrder (const void *a, const void *b) |
Static Private Member Functions inherited from iRContainer< C > | |
static int | SortOrder (const void *a, const void *b) |
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.
Constructor & Destructor Documentation
Constructor of a vector.
- Parameters
-
metaconcept Meta-concept associated with the vector.
Constructor of a vector.
- Parameters
-
metaconcept Meta-concept associated with the vector. max Initial number of maximal references.
|
virtual |
Destruct the vector.
Member Function Documentation
|
static |
Static function used to order the concept weights.
- Parameters
-
a Pointer to the first object. b Pointer to the second object.
|
protected |
Copy method for the vectors.
- Parameters
-
vector Source vector.
int Compare | ( | const GVector & | vector | ) | const |
Compare two vectors using to their meta-concept.
- See also
- R::RContainer
- Parameters
-
vector Vector.
- Returns
- int
int Compare | ( | const GConcept & | metaconcept | ) | const |
Compare a vector and a meta-concept.
- See also
- R::RContainer
- Parameters
-
metaconcept Meta-concept.
- Returns
- int
int Compare | ( | const GConcept * | metaconcept | ) | const |
Compare a vector and a meta-concept.
- See also
- R::RContainer
- Parameters
-
metaconcept Meta-concept.
- Returns
- int
R::RConstCursor<GConceptRef> GetRefs | ( | void | ) | const |
Get a cursor on the concept references.
- Returns
- a cursor of GConceptRef.
R::RCursor<GConceptRef> GetRefs | ( | void | ) |
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.
const GConceptRef* GetRef | ( | GConceptRef * | ref | ) | const |
Get a concept reference based on a given one. If it is not found, it is created with a null weight.
- Parameters
-
ref Concept reference.
- Returns
- a pointer to a GConceptRef.
GConceptRef* GetRef | ( | GConceptRef * | ref | ) |
Get a concept reference based on a given one. If it is not found, it is created with a null weight.
- Parameters
-
ref Concept reference.
- Returns
- a pointer to a GConceptRef.
const GConceptRef* GetRef | ( | GConcept * | concept | ) | const |
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
-
concept Concept.
- 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
-
concept Concept.
- Returns
- a pointer to a GConceptRef.
void InsertRef | ( | GConceptRef * | ref | ) |
Insert a concept reference.
- Parameters
-
ref Concept reference.
void DeleteRef | ( | GConceptRef * | ref | ) |
Delete a concept reference.
- Parameters
-
ref Concept reference.
void DeleteRef | ( | const GConcept * | concept | ) |
Delete an reference to a given concept.
- Parameters
-
concept Concept.
bool IsIn | ( | const GConcept * | concept | ) | const |
Verify if a given concept is in the vector.
- Parameters
-
concept Concept.
- Returns
- true if the concept is contained.
size_t GetTab | ( | const GConceptRef ** | tab | ) | const |
Fill an array with the concept references.
- Parameters
-
tab Array to fill.
- Returns
- the number of elements copied.
void Clear | ( | size_t | size = 0 | ) |
Clear the vector and extend it if necessary.
- Parameters
-
size Expected size of the vector.
size_t GetNb | ( | void | ) | const |
- Returns
- the number of elements in the container.
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.
|
private |
Analyze the weights to compute the maximum weights for the different types.
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.
double GetSumWeights | ( | void | ) | const |
Compute the sum of the weights of the concept references in the vector.
- Returns
- double.
double GetSumAbsWeights | ( | void | ) | const |
Compute the sum of the absolute weights 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
-
vector Destination vectors. type Type selected.
void Print | ( | S & | stream, |
const R::RString & | name, | ||
const char * | format = "%E" , |
||
size_t | colsize = 12 |
||
) | const |
Print the content of the vector.
- Template Parameters
-
S Stream class that implements the << operator.
- Parameters
-
stream Stream. name Name of the vector. format Format used to print the number. By default, it is "%E". colsize Size of a column. By default, it is 12.
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
-
vector Vector to search for the intersection.
- Warning
- Only vectors associated with the same meta-concept can be compared.
Assignment operator for the vectors.
- Parameters
-
vector Vector to assign.
Addition operator for the vectors.
- Parameters
-
vector Vector to add.
- Warning
- Only vectors associated with the same meta-concept can be added.
Subtraction operator for the vectors.
- Parameters
-
vector Vector 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
-
nb Number to multiply by.
GVector& operator/= | ( | const double | nb | ) |
Division operator for the vectors.
- Parameters
-
nb Number to multiply by.
Member Data Documentation
|
private |
Meta-concept associated to the vector.
|
private |
The maximal weight of the vector.
|
private |
The maximal absolute weight the vector.