SNAP Library 2.3, Developer Reference
2014-06-16 11:58:46
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <ds.h>
Public Types | |
typedef TVal * | TIter |
Public Member Functions | |
TVec () | |
TVec (const TVec &Vec) | |
TVec (const int &_Vals) | |
TVec (const int &_MxVals, const int &_Vals) | |
TVec (TVal *_ValT, const int &_Vals) | |
~TVec () | |
TVec (TSIn &SIn) | |
void | Load (TSIn &SIn) |
void | Save (TSOut &SOut) const |
void | LoadXml (const PXmlTok &XmlTok, const TStr &Nm="") |
void | SaveXml (TSOut &SOut, const TStr &Nm) const |
TVec< TVal > & | operator= (const TVec< TVal > &Vec) |
TVec< TVal > & | operator+ (const TVal &Val) |
bool | operator== (const TVec< TVal > &Vec) const |
bool | operator< (const TVec< TVal > &Vec) const |
const TVal & | operator[] (const int &ValN) const |
TVal & | operator[] (const int &ValN) |
int | GetMemUsed () const |
int | GetPrimHashCd () const |
int | GetSecHashCd () const |
void | Gen (const int &_Vals) |
void | Gen (const int &_MxVals, const int &_Vals) |
void | GenExt (TVal *_ValT, const int &_Vals) |
bool | IsExt () const |
void | Reserve (const int &_MxVals) |
void | Reserve (const int &_MxVals, const int &_Vals) |
void | Clr (const bool &DoDel=true, const int &NoDelLim=-1) |
void | Trunc (const int &_Vals=-1) |
void | Pack () |
void | MoveFrom (TVec< TVal > &Vec) |
void | Swap (TVec< TVal > &Vec) |
bool | Empty () const |
int | Len () const |
int | Reserved () const |
const TVal & | Last () const |
TVal & | Last () |
int | LastValN () const |
const TVal & | LastLast () const |
TVal & | LastLast () |
TIter | BegI () const |
TIter | EndI () const |
TIter | GetI (const int &ValN) const |
int | Add () |
int | Add (const TVal &Val) |
int | Add (const TVal &Val, const int &ResizeLen) |
int | AddV (const TVec< TVal > &ValV) |
int | AddSorted (const TVal &Val, const bool &Asc=true, const int &_MxVals=-1) |
int | AddBackSorted (const TVal &Val, const bool &Asc) |
int | AddMerged (const TVal &Val) |
int | AddVMerged (const TVec< TVal > &ValV) |
int | AddUnique (const TVal &Val) |
const TVal & | GetVal (const int &ValN) const |
TVal & | GetVal (const int &ValN) |
void | GetSubValV (const int &BValN, const int &EValN, TVec< TVal > &ValV) const |
void | Ins (const int &ValN, const TVal &Val) |
void | Del (const int &ValN) |
void | Del (const int &MnValN, const int &MxValN) |
void | DelLast () |
bool | DelIfIn (const TVal &Val) |
void | DelAll (const TVal &Val) |
void | PutAll (const TVal &Val) |
void | Swap (const int &ValN1, const int &ValN2) |
int | GetPivotValN (const int &LValN, const int &RValN) const |
void | BSort (const int &MnLValN, const int &MxRValN, const bool &Asc) |
void | ISort (const int &MnLValN, const int &MxRValN, const bool &Asc) |
int | Partition (const int &MnLValN, const int &MxRValN, const bool &Asc) |
void | QSort (const int &MnLValN, const int &MxRValN, const bool &Asc) |
void | Sort (const bool &Asc=true) |
bool | IsSorted (const bool &Asc=true) const |
void | Shuffle (TRnd &Rnd) |
void | Reverse () |
void | Reverse (int First, int Last) |
void | Merge () |
bool | NextPerm () |
bool | PrevPerm () |
void | MakeHeap () |
void | PushHeap (const TVal &Val) |
const TVal & | TopHeap () const |
TVal | PopHeap () |
template<class TCmp > | |
void | MakeHeap (const TCmp &Cmp) |
template<class TCmp > | |
void | PushHeap (const TVal &Val, const TCmp &Cmp) |
template<class TCmp > | |
TVal | PopHeap (const TCmp &Cmp) |
template<class TCmp > | |
void | PushHeap (const int &First, int HoleIdx, const int &Top, TVal Val, const TCmp &Cmp) |
template<class TCmp > | |
void | AdjustHeap (const int &First, int HoleIdx, const int &Len, TVal Val, const TCmp &Cmp) |
template<class TCmp > | |
void | MakeHeap (const int &First, const int &Len, const TCmp &Cmp) |
template<class TCmp > | |
void | SortCmp (const TCmp &Cmp) |
template<class TCmp > | |
bool | IsSortedCmp (const TCmp &Cmp) const |
void | Intrs (const TVec< TVal > &ValV) |
void | Union (const TVec< TVal > &ValV) |
void | Diff (const TVec< TVal > &ValV) |
void | Minus (const TVec< TVal > &ValV) |
void | Intrs (const TVec< TVal > &ValV, TVec< TVal > &DstValV) const |
void | Union (const TVec< TVal > &ValV, TVec< TVal > &DstValV) const |
void | Diff (const TVec< TVal > &ValV, TVec< TVal > &DstValV) const |
int | IntrsLen (const TVec< TVal > &ValV) const |
Returns the size of the intersection (number of common elements) with vector ValV . Method assumes both vectors are sorted in ascending order! More... | |
int | UnionLen (const TVec< TVal > &ValV) const |
Returns the size of the union with vector ValV . Method assumes both vectors are sorted in ascending order! More... | |
void | Minus (const TVec< TVal > &ValV, TVec< TVal > &DstValV) const |
int | Count (const TVal &Val) const |
int | SearchBin (const TVal &Val) const |
int | SearchBin (const TVal &Val, int &InsValN) const |
int | SearchForw (const TVal &Val, const int &BValN=0) const |
int | SearchBack (const TVal &Val) const |
int | SearchVForw (const TVec< TVal > &ValV, const int &BValN=0) const |
bool | IsIn (const TVal &Val) const |
bool | IsIn (const TVal &Val, int &ValN) const |
bool | IsInBin (const TVal &Val) const |
int | GetMxValN () const |
TVal & | GetDat (const TVal &Val) const |
TVal & | GetAddDat (const TVal &Val) |
Static Public Member Functions | |
static void | SwapI (TIter LVal, TIter RVal) |
template<class TCmp > | |
static TIter | GetPivotValNCmp (const TIter &BI, const TIter &EI, const TCmp &Cmp) |
template<class TCmp > | |
static TIter | PartitionCmp (TIter BI, TIter EI, const TVal Pivot, const TCmp &Cmp) |
template<class TCmp > | |
static void | BSortCmp (TIter BI, TIter EI, const TCmp &Cmp) |
template<class TCmp > | |
static void | ISortCmp (TIter BI, TIter EI, const TCmp &Cmp) |
template<class TCmp > | |
static void | QSortCmp (TIter BI, TIter EI, const TCmp &Cmp) |
static TVec< TVal > | GetV (const TVal &Val1) |
static TVec< TVal > | GetV (const TVal &Val1, const TVal &Val2) |
static TVec< TVal > | GetV (const TVal &Val1, const TVal &Val2, const TVal &Val3) |
static TVec< TVal > | GetV (const TVal &Val1, const TVal &Val2, const TVal &Val3, const TVal &Val4) |
static TVec< TVal > | GetV (const TVal &Val1, const TVal &Val2, const TVal &Val3, const TVal &Val4, const TVal &Val5) |
static TVec< TVal > | GetV (const TVal &Val1, const TVal &Val2, const TVal &Val3, const TVal &Val4, const TVal &Val5, const TVal &Val6) |
static TVec< TVal > | GetV (const TVal &Val1, const TVal &Val2, const TVal &Val3, const TVal &Val4, const TVal &Val5, const TVal &Val6, const TVal &Val7) |
static TVec< TVal > | GetV (const TVal &Val1, const TVal &Val2, const TVal &Val3, const TVal &Val4, const TVal &Val5, const TVal &Val6, const TVal &Val7, const TVal &Val8) |
static TVec< TVal > | GetV (const TVal &Val1, const TVal &Val2, const TVal &Val3, const TVal &Val4, const TVal &Val5, const TVal &Val6, const TVal &Val7, const TVal &Val8, const TVal &Val9) |
Protected Member Functions | |
void | Resize (const int &_MxVals=-1) |
TStr | GetXOutOfBoundsErrMsg (const int &ValN) const |
Protected Attributes | |
int | MxVals |
int | Vals |
TVal * | ValT |
typedef TVal* TGLib_OLD::TVec< TVal >::TIter |
|
inline |
TGLib_OLD::TVec< TVal >::TVec | ( | const TVec< TVal > & | Vec | ) |
|
inlineexplicit |
|
inline |
|
inlineexplicit |
|
inline |
|
inlineexplicit |
|
inline |
Definition at line 1563 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::GetAddDat(), TGLib_OLD::TVec< ::TSize >::operator+(), TGLib_OLD::TVec< ::TSize >::PushHeap(), and TGLib_OLD::TVecPool< TVal >::TVecPool().
|
inline |
|
inline |
int TVec< TVal >::AddBackSorted | ( | const TVal & | Val, |
const bool & | Asc | ||
) |
int TVec< TVal >::AddMerged | ( | const TVal & | Val | ) |
int TVec< TVal >::AddSorted | ( | const TVal & | Val, |
const bool & | Asc = true , |
||
const int & | _MxVals = -1 |
||
) |
int TVec< TVal >::AddUnique | ( | const TVal & | Val | ) |
Definition at line 1970 of file ds.h.
References Assert, and TVec< TVal, TSizeTy >::Vals.
Definition at line 2011 of file ds.h.
References Assert, and TVec< TVal, TSizeTy >::Vals.
|
inline |
Definition at line 1626 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::MakeHeap(), and TGLib_OLD::TVec< ::TSize >::PopHeap().
|
inline |
Definition at line 1559 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::IsSortedCmp(), and TGLib_OLD::TVec< ::TSize >::SortCmp().
void TVec< TVal >::BSort | ( | const int & | MnLValN, |
const int & | MxRValN, | ||
const bool & | Asc | ||
) |
|
inlinestatic |
void TVec< TVal >::Clr | ( | const bool & | DoDel = true , |
const int & | NoDelLim = -1 |
||
) |
Definition at line 1904 of file ds.h.
References IAssert.
Referenced by TGLib_OLD::TVecPool< TVal >::Clr().
int TVec< TVal >::Count | ( | const TVal & | Val | ) | const |
void TVec< TVal >::Del | ( | const int & | ValN | ) |
Definition at line 2045 of file ds.h.
References Assert.
Referenced by TGLib_OLD::TVec< ::TSize >::DelLast().
void TVec< TVal >::Del | ( | const int & | MnValN, |
const int & | MxValN | ||
) |
void TVec< TVal >::DelAll | ( | const TVal & | Val | ) |
bool TVec< TVal >::DelIfIn | ( | const TVal & | Val | ) |
|
inline |
Definition at line 1581 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::PopHeap().
void TVec< TVal >::Diff | ( | const TVec< TVal > & | ValV, |
TVec< TVal > & | DstValV | ||
) | const |
Definition at line 2346 of file ds.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), TVec< TVal, TSizeTy >::GetVal(), and TVec< TVal, TSizeTy >::Len().
|
inline |
Definition at line 1546 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::PopHeap().
|
inline |
Definition at line 1560 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::IsSortedCmp(), and TGLib_OLD::TVec< ::TSize >::SortCmp().
|
inline |
Definition at line 1524 of file ds.h.
Referenced by TGLib_OLD::TVecPool< TVal >::TVecPool().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
int TVec< TVal >::GetPivotValN | ( | const int & | LValN, |
const int & | RValN | ||
) | const |
Definition at line 2119 of file ds.h.
References TInt::GetRnd().
|
inlinestatic |
Definition at line 1648 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::QSortCmp().
int TVec< TVal >::GetPrimHashCd | ( | ) | const |
int TVec< TVal >::GetSecHashCd | ( | ) | const |
void TVec< TVal >::GetSubValV | ( | const int & | BValN, |
const int & | EValN, | ||
TVec< TVal > & | ValV | ||
) | const |
Definition at line 2026 of file ds.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Gen(), TInt::GetInRng(), and TInt::GetMx().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Definition at line 1774 of file ds.h.
|
inlinestatic |
Definition at line 1776 of file ds.h.
|
inlinestatic |
Definition at line 1778 of file ds.h.
|
inlinestatic |
Definition at line 1780 of file ds.h.
|
inlinestatic |
Definition at line 1782 of file ds.h.
|
inline |
Definition at line 1575 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::Last().
|
inline |
Definition at line 1821 of file ds.h.
References TInt::GetStr(), and GetTypeNm().
Referenced by TGLib_OLD::TVec< ::TSize >::LastLast(), and TGLib_OLD::TVec< ::TSize >::operator[]().
void TVec< TVal >::Ins | ( | const int & | ValN, |
const TVal & | Val | ||
) |
void TVec< TVal >::Intrs | ( | const TVec< TVal > & | ValV, |
TVec< TVal > & | DstValV | ||
) | const |
Definition at line 2284 of file ds.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), TVec< TVal, TSizeTy >::GetVal(), and TVec< TVal, TSizeTy >::Len().
Returns the size of the intersection (number of common elements) with vector ValV
. Method assumes both vectors are sorted in ascending order!
Definition at line 2362 of file ds.h.
References TVec< TVal, TSizeTy >::GetVal(), and TVec< TVal, TSizeTy >::Len().
|
inline |
|
inline |
|
inline |
|
inline |
void TVec< TVal >::ISort | ( | const int & | MnLValN, |
const int & | MxRValN, | ||
const bool & | Asc | ||
) |
|
inlinestatic |
Definition at line 1688 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::QSortCmp().
bool TVec< TVal >::IsSorted | ( | const bool & | Asc = true | ) | const |
|
inline |
|
inline |
Definition at line 1549 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::GetAddDat(), and TGLib_OLD::TVec< ::TSize >::PopHeap().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 1547 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::DelLast(), TGLib_OLD::TVecPool< TVal >::GetVecs(), TGLib_OLD::TVecPool< TVal >::IsVId(), TGLib_OLD::TVec< ::TSize >::Last(), TGLib_OLD::TVec< ::TSize >::LastValN(), TGLib_OLD::TVec< ::TSize >::MakeHeap(), TGLib_OLD::TVec< ::TSize >::PopHeap(), and TGLib_OLD::TVec< ::TSize >::PushHeap().
Definition at line 1837 of file ds.h.
References TSIn::Load().
Referenced by TGLib_OLD::TVec< ::TSize >::TVec().
void TGLib_OLD::TVec< TVal >::LoadXml | ( | const PXmlTok & | XmlTok, |
const TStr & | Nm = "" |
||
) |
|
inline |
Definition at line 1608 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::MakeHeap().
|
inline |
Definition at line 1612 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::MakeHeap().
|
inline |
void TVec< TVal >::Merge | ( | ) |
Definition at line 2202 of file ds.h.
References Assert, TVec< TVal, TSizeTy >::Len(), and TVec< TVal, TSizeTy >::Sort().
void TVec< TVal >::Minus | ( | const TVec< TVal > & | ValV, |
TVec< TVal > & | DstValV | ||
) | const |
Definition at line 1952 of file ds.h.
References TVec< TVal, TSizeTy >::MxVals, TVec< TVal, TSizeTy >::Vals, and TVec< TVal, TSizeTy >::ValT.
bool TVec< TVal >::NextPerm | ( | ) |
|
inline |
Definition at line 1873 of file ds.h.
References TVec< TVal, TSizeTy >::Len(), and TVec< TVal, TSizeTy >::ValT.
Definition at line 1853 of file ds.h.
References TVec< TVal, TSizeTy >::Vals, and TVec< TVal, TSizeTy >::ValT.
Definition at line 1864 of file ds.h.
References TVec< TVal, TSizeTy >::Len(), and TVec< TVal, TSizeTy >::ValT.
|
inline |
Definition at line 1512 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::GetAddDat(), TGLib_OLD::TVec< ::TSize >::GetDat(), and TGLib_OLD::TVec< ::TSize >::GetVal().
|
inline |
void TVec< TVal >::Pack | ( | ) |
int TVec< TVal >::Partition | ( | const int & | MnLValN, |
const int & | MxRValN, | ||
const bool & | Asc | ||
) |
|
inlinestatic |
Definition at line 1668 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::QSortCmp().
|
inline |
Definition at line 1611 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::PopHeap().
|
inline |
bool TVec< TVal >::PrevPerm | ( | ) |
|
inline |
Definition at line 1609 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::AdjustHeap(), and TGLib_OLD::TVec< ::TSize >::PushHeap().
|
inline |
Definition at line 1613 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::PushHeap().
|
inline |
void TVec< TVal >::PutAll | ( | const TVal & | Val | ) |
void TVec< TVal >::QSort | ( | const int & | MnLValN, |
const int & | MxRValN, | ||
const bool & | Asc | ||
) |
|
inlinestatic |
Definition at line 1699 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::QSortCmp(), and TGLib_OLD::TVec< ::TSize >::SortCmp().
|
inline |
|
inline |
|
inline |
|
protected |
Definition at line 1789 of file ds.h.
References Assert, TStr::CStr(), FailR, TStr::Fmt(), GetTypeNm(), IAssertR, and TInt::Mx.
Referenced by TGLib_OLD::TVec< ::TSize >::Add(), and TGLib_OLD::TVec< ::TSize >::Reserve().
void TVec< TVal >::Reverse | ( | ) |
|
inline |
Definition at line 1846 of file ds.h.
References TSOut::Save().
void TGLib_OLD::TVec< TVal >::SaveXml | ( | TSOut & | SOut, |
const TStr & | Nm | ||
) | const |
int TVec< TVal >::SearchBack | ( | const TVal & | Val | ) | const |
int TVec< TVal >::SearchBin | ( | const TVal & | Val | ) | const |
Definition at line 2407 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::IsInBin().
int TVec< TVal >::SearchBin | ( | const TVal & | Val, |
int & | InsValN | ||
) | const |
int TVec< TVal >::SearchForw | ( | const TVal & | Val, |
const int & | BValN = 0 |
||
) | const |
Definition at line 2429 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::GetAddDat(), TGLib_OLD::TVec< ::TSize >::GetDat(), and TGLib_OLD::TVec< ::TSize >::IsIn().
int TVec< TVal >::SearchVForw | ( | const TVec< TVal > & | ValV, |
const int & | BValN = 0 |
||
) | const |
Definition at line 2443 of file ds.h.
References TVec< TVal, TSizeTy >::Len().
Definition at line 2190 of file ds.h.
References TRnd::GetUniDevInt(), and Swap().
void TVec< TVal >::Sort | ( | const bool & | Asc = true | ) |
|
inline |
Definition at line 1961 of file ds.h.
References TVec< TVal, TSizeTy >::MxVals, Swap(), TVec< TVal, TSizeTy >::Vals, and TVec< TVal, TSizeTy >::ValT.
Referenced by TGLib_OLD::TVec< ::TSize >::Reverse().
|
inline |
|
inlinestatic |
Definition at line 1588 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::BSortCmp(), and TGLib_OLD::TVec< ::TSize >::PartitionCmp().
|
inline |
void TVec< TVal >::Trunc | ( | const int & | _Vals = -1 | ) |
void TVec< TVal >::Union | ( | const TVec< TVal > & | ValV, |
TVec< TVal > & | DstValV | ||
) | const |
Definition at line 2298 of file ds.h.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Gen(), TInt::GetMx(), TVec< TVal, TSizeTy >::GetVal(), and TVec< TVal, TSizeTy >::Len().
Returns the size of the union with vector ValV
. Method assumes both vectors are sorted in ascending order!
Definition at line 2376 of file ds.h.
References TVec< TVal, TSizeTy >::GetVal(), and TVec< TVal, TSizeTy >::Len().
|
protected |
Definition at line 1485 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::Add(), TGLib_OLD::TVec< ::TSize >::Gen(), TGLib_OLD::TVec< ::TSize >::GenExt(), TGLib_OLD::TVec< ::TSize >::GetAddDat(), TGLib_OLD::TVec< ::TSize >::GetMemUsed(), TGLib_OLD::TVec< ::TSize >::IsExt(), TGLib_OLD::TVec< ::TSize >::Reserved(), TGLib_OLD::TVec< ::TSize >::TVec(), and TGLib_OLD::TVec< ::TSize >::~TVec().
|
protected |
Definition at line 1486 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::Add(), TGLib_OLD::TVec< ::TSize >::Empty(), TGLib_OLD::TVec< ::TSize >::EndI(), TGLib_OLD::TVec< ::TSize >::Gen(), TGLib_OLD::TVec< ::TSize >::GenExt(), TGLib_OLD::TVec< ::TSize >::LastLast(), TGLib_OLD::TVec< ::TSize >::Len(), TGLib_OLD::TVec< ::TSize >::operator[](), TGLib_OLD::TVec< ::TSize >::Reserve(), and TGLib_OLD::TVec< ::TSize >::TVec().
|
protected |
Definition at line 1487 of file ds.h.
Referenced by TGLib_OLD::TVec< ::TSize >::Add(), TGLib_OLD::TVec< ::TSize >::AdjustHeap(), TGLib_OLD::TVec< ::TSize >::BegI(), TGLib_OLD::TVec< ::TSize >::EndI(), TGLib_OLD::TVec< ::TSize >::Gen(), TGLib_OLD::TVec< ::TSize >::GenExt(), TGLib_OLD::TVec< ::TSize >::GetI(), TGLib_OLD::TVec< ::TSize >::LastLast(), TGLib_OLD::TVec< ::TSize >::MakeHeap(), TGLib_OLD::TVec< ::TSize >::operator[](), TGLib_OLD::TVec< ::TSize >::PopHeap(), TGLib_OLD::TVec< ::TSize >::PushHeap(), TGLib_OLD::TVec< ::TSize >::Swap(), TGLib_OLD::TVec< ::TSize >::TopHeap(), TGLib_OLD::TVec< ::TSize >::TVec(), and TGLib_OLD::TVec< ::TSize >::~TVec().