CMiniLexicon::FindMajorSignatures(): use log file routines
[linguistica.git] / SparseIntVector.h
blobb5279ac3ae6fb6bdbbb8bf7941333b92e0b39cf4
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.
8 #include <qstring.h>
10 class CParse;
13 class CSparseIntVector
14 { friend int Overlap (CSparseIntVector& List1, CSparseIntVector& List2);
15 friend int Overlap (CSparseIntVector* List1, CSparseIntVector* List2, CSparseIntVector&);
17 // friend CLexicon;
18 // friend CMorphemeMatrix;
19 // friend CWordMatrix;
21 protected:
23 int Length;
24 int* Dimension;
25 int* Values;
26 int NumberOfSlots;
28 int ContainsDim (int n);
29 void SetLength(int n);
30 int operator[] (int n); //n is the local value
31 int NormalizedFlag;
34 public:
35 CSparseIntVector();
36 CSparseIntVector ( int n);
37 CSparseIntVector (CSparseIntVector&);
38 ~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);
50 int GetLength();
51 int GetFirstDimension();
52 int GetTopDimension();
53 int GetNumberOfSlots ();
55 void Clear();
56 void ClearOut();
57 int GetNormalizedFlag();
59 CParse Display();
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*);
76 void Normalize();
77 int InnerProduct (CSparseIntVector*);
78 void Ingest(CSparseIntVector*);
83 #endif // SPARSEINTVECTOR_H