1 // Vector of integers with mostly zero entries
2 // Copyright © 2009 The University of Chicago
3 #ifndef SPARSEINTVECTOR_H
4 #define SPARSEINTVECTOR_H
6 // See also CSparseVector.
13 class CSparseIntVector
14 { friend int Overlap (CSparseIntVector
& List1
, CSparseIntVector
& List2
);
15 friend int Overlap (CSparseIntVector
* List1
, CSparseIntVector
* List2
, CSparseIntVector
&);
18 // friend CMorphemeMatrix;
19 // friend CWordMatrix;
28 int ContainsDim (int n
);
29 void SetLength(int n
);
30 int operator[] (int n
); //n is the local value
36 CSparseIntVector ( int n
);
37 CSparseIntVector (CSparseIntVector
&);
41 int operator< (CSparseIntVector
&);
42 int operator> (CSparseIntVector
&);
43 void operator() (int n
, int val
); // n is the value of Dimension
44 int operator() (int n
); // n is the value of Dimension
45 void operator= (CSparseIntVector
&);
46 int operator== (CSparseIntVector
&);
48 // for iteration: (uses MFC-style syntax):
49 int GetNextDimension (int& DimOut
, int& Position
);
51 int GetFirstDimension();
52 int GetTopDimension();
53 int GetNumberOfSlots ();
57 int GetNormalizedFlag();
60 QString
DisplayAsString();
61 QString
DisplayAsStringNoColons();
64 int Union (CSparseIntVector
& );//returns length of result
65 bool Contains (CSparseIntVector
* );// just checks dimensions that are present, not the values
67 int GetAt( int dim
); //uses outside world value of dimension
68 void SetAt ( int, int);
69 int Delete (int dim
); //uses outside world value of dim
70 void IncrementAt(int, int = 1);
72 void SetNumberOfSlots(int);
73 // TODO: ostream& OutputToStream (CWordCollection&, ostream& stream, int threshold=2);
74 // TODO: WordCollection void MakeLogFreq (CWordCollection*);
77 int InnerProduct (CSparseIntVector
*);
78 void Ingest(CSparseIntVector
*);
83 #endif // SPARSEINTVECTOR_H