SNAP Library , Developer Reference  2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TVVec< TVal > Class Template Reference

#include <ds.h>

Collaboration diagram for TVVec< TVal >:

List of all members.

Public Member Functions

 TVVec ()
 TVVec (const TVVec &Vec)
 TVVec (const int &_XDim, const int &_YDim)
 TVVec (const TVec< TVal > &_ValV, const int &_XDim, const int &_YDim)
 TVVec (TSIn &SIn)
void Load (TSIn &SIn)
void Save (TSOut &SOut) const
TVVec< TVal > & operator= (const TVVec< TVal > &Vec)
bool operator== (const TVVec &Vec) const
bool Empty () const
void Clr ()
void Gen (const int &_XDim, const int &_YDim)
int GetXDim () const
int GetYDim () const
int GetRows () const
int GetCols () const
TVec< TVal > & Get1DVec ()
const TVal & At (const int &X, const int &Y) const
TVal & At (const int &X, const int &Y)
TVal & operator() (const int &X, const int &Y)
const TVal & operator() (const int &X, const int &Y) const
void PutXY (const int &X, const int &Y, const TVal &Val)
void PutAll (const TVal &Val)
void PutX (const int &X, const TVal &Val)
void PutY (const int &Y, const TVal &Val)
TVal GetXY (const int &X, const int &Y) const
void GetRow (const int &RowN, TVec< TVal > &Vec) const
void GetCol (const int &ColN, TVec< TVal > &Vec) const
void SwapX (const int &X1, const int &X2)
void SwapY (const int &Y1, const int &Y2)
void Swap (TVVec< TVal > &Vec)
void ShuffleX (TRnd &Rnd)
void ShuffleY (TRnd &Rnd)
void GetMxValXY (int &X, int &Y) const
void CopyFrom (const TVVec< TVal > &VVec)
void AddXDim ()
void AddYDim ()
void DelX (const int &X)
void DelY (const int &Y)

Private Attributes

TInt XDim
TInt YDim
TVec< TVal > ValV

Detailed Description

template<class TVal>
class TVVec< TVal >

Definition at line 1721 of file ds.h.


Constructor & Destructor Documentation

template<class TVal>
TVVec< TVal >::TVVec ( ) [inline]

Definition at line 1726 of file ds.h.

: XDim(), YDim(), ValV(){}
template<class TVal>
TVVec< TVal >::TVVec ( const TVVec< TVal > &  Vec) [inline]

Definition at line 1727 of file ds.h.

                         :
    XDim(Vec.XDim), YDim(Vec.YDim), ValV(Vec.ValV){}
template<class TVal>
TVVec< TVal >::TVVec ( const int &  _XDim,
const int &  _YDim 
) [inline]

Definition at line 1729 of file ds.h.

                                           :
    XDim(), YDim(), ValV(){Gen(_XDim, _YDim);}
template<class TVal>
TVVec< TVal >::TVVec ( const TVec< TVal > &  _ValV,
const int &  _XDim,
const int &  _YDim 
) [inline, explicit]

Definition at line 1731 of file ds.h.

                                                                             :
    XDim(_XDim), YDim(_YDim), ValV(_ValV){ IAssert(ValV.Len()==XDim*YDim); }
template<class TVal>
TVVec< TVal >::TVVec ( TSIn SIn) [inline, explicit]

Definition at line 1733 of file ds.h.

{Load(SIn);}

Member Function Documentation

template<class TVal >
void TVVec< TVal >::AddXDim ( )

Definition at line 1842 of file ds.h.

References TVVec< TVal >::CopyFrom().

                         {
  TVVec<TVal> NewVVec(XDim+1, YDim);
  NewVVec.CopyFrom(*this);
  *this=NewVVec;
}

Here is the call graph for this function:

template<class TVal >
void TVVec< TVal >::AddYDim ( )

Definition at line 1849 of file ds.h.

References TVVec< TVal >::CopyFrom().

                         {
  TVVec<TVal> NewVVec(XDim, YDim+1);
  NewVVec.CopyFrom(*this);
  *this=NewVVec;
}

Here is the call graph for this function:

template<class TVal>
TVal& TVVec< TVal >::At ( const int &  X,
const int &  Y 
) [inline]

Definition at line 1757 of file ds.h.

                                      {
    Assert((0<=X)&&(X<int(XDim))&&(0<=Y)&&(Y<int(YDim)));
    return ValV[X*YDim+Y];}
template<class TVal>
void TVVec< TVal >::Clr ( ) [inline]

Definition at line 1744 of file ds.h.

Referenced by TMAGFitBern::Clr(), TMAGFitBern::ComputeJointLL(), TMAGFitBern::DoEStep(), TLAMisc::LoadMatlabTFltVV(), and TMAGFitBern::UpdateAffMtxV().

{XDim=0; YDim=0; ValV.Clr();}

Here is the caller graph for this function:

template<class TVal>
void TVVec< TVal >::CopyFrom ( const TVVec< TVal > &  VVec)

Definition at line 1831 of file ds.h.

References TVVec< TVal >::At(), TInt::GetMn(), TVVec< TVal >::GetXDim(), and TVVec< TVal >::GetYDim().

Referenced by TVVec< TVal >::AddXDim(), and TVVec< TVal >::AddYDim().

                                                 {
  int CopyXDim=TInt::GetMn(GetXDim(), VVec.GetXDim());
  int CopyYDim=TInt::GetMn(GetYDim(), VVec.GetYDim());
  for (int X=0; X<CopyXDim; X++){
    for (int Y=0; Y<CopyYDim; Y++){
      At(X, Y)=VVec.At(X, Y);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TVal >
void TVVec< TVal >::DelX ( const int &  X)

Definition at line 1856 of file ds.h.

References TVVec< TVal >::At().

Referenced by TSvd::Svd(), and TSvd::Svd1Based().

                                  {
  TVVec<TVal> NewVVec(XDim-1, YDim);
  for (int Y=0; Y<YDim; Y++){
    for (int LX=0; LX<X; LX++){
      NewVVec.At(LX, Y)=At(LX, Y);}
    for (int RX=X+1; RX<XDim; RX++){
      NewVVec.At(RX-1, Y)=At(RX, Y);}
  }
  *this=NewVVec;
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TVal >
void TVVec< TVal >::DelY ( const int &  Y)

Definition at line 1868 of file ds.h.

References TVVec< TVal >::At().

Referenced by TSvd::Svd(), and TSvd::Svd1Based().

                                  {
  TVVec<TVal> NewVVec(XDim, YDim-1);
  for (int X=0; X<XDim; X++){
    for (int LY=0; LY<Y; LY++){
      NewVVec.At(X, LY)=At(X, LY);}
    for (int RY=Y+1; RY<YDim; RY++){
      NewVVec.At(X, RY-1)=At(X, RY);}
  }
  *this=NewVVec;
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TVal>
bool TVVec< TVal >::Empty ( ) const [inline]

Definition at line 1743 of file ds.h.

Referenced by TStr::GetDChStr().

{return ValV.Len()==0;}

Here is the caller graph for this function:

template<class TVal>
TVec<TVal>& TVVec< TVal >::Get1DVec ( ) [inline]

Definition at line 1752 of file ds.h.

{return ValV;}
template<class TVal>
void TVVec< TVal >::GetCol ( const int &  ColN,
TVec< TVal > &  Vec 
) const

Definition at line 1888 of file ds.h.

References TVec< TVal >::Add(), and TVec< TVal >::Gen().

Referenced by TSnap::GetEigVec(), TSnap::GetInvParticipRat(), and TSnap::GetSngVec().

                                                               {
  Vec.Gen(GetRows(), 0);
  for (int row = 0; row < GetRows(); row++) {
    Vec.Add(At(row, ColN));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TVal >
void TVVec< TVal >::GetMxValXY ( int &  X,
int &  Y 
) const

Definition at line 1824 of file ds.h.

                                                 {
  int MxValN=ValV.GetMxValN();
  Y=MxValN%YDim;
  X=MxValN/YDim;
}
template<class TVal>
void TVVec< TVal >::GetRow ( const int &  RowN,
TVec< TVal > &  Vec 
) const

Definition at line 1880 of file ds.h.

References TVec< TVal >::Add(), and TVec< TVal >::Gen().

Referenced by TMAGFitBern::UpdateApxPhiMI().

                                                               {
  Vec.Gen(GetCols(), 0);
  for (int col = 0; col < GetCols(); col++) {
    Vec.Add(At(RowN, col));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TVal>
int TVVec< TVal >::GetXDim ( ) const [inline]

Definition at line 1748 of file ds.h.

Referenced by TMAGFitBern::ComputeMI(), TVVec< TVal >::CopyFrom(), TMAGFitBern::CountAttr(), TMom::DefVV(), TMom::IsUsableVV(), TMAGFitBern::SetPhiVV(), TSvd::Svd(), and TSvd::Svd1Based().

{return XDim;}

Here is the caller graph for this function:

template<class TVal>
TVal TVVec< TVal >::GetXY ( const int &  X,
const int &  Y 
) const [inline]

Definition at line 1771 of file ds.h.

                                               {
    Assert((0<=X)&&(X<int(XDim))&&(0<=Y)&&(Y<int(YDim)));
    return ValV[X*YDim+Y];}
template<class TVal>
void TVVec< TVal >::Load ( TSIn SIn) [inline]

Definition at line 1734 of file ds.h.

Referenced by TVVec< TFlt >::TVVec().

{XDim.Load(SIn); YDim.Load(SIn); ValV.Load(SIn);}

Here is the caller graph for this function:

template<class TVal>
TVal& TVVec< TVal >::operator() ( const int &  X,
const int &  Y 
) [inline]

Definition at line 1760 of file ds.h.

                                              {
    return At(X, Y);}
template<class TVal>
const TVal& TVVec< TVal >::operator() ( const int &  X,
const int &  Y 
) const [inline]

Definition at line 1762 of file ds.h.

                                                           {
    return At(X, Y);}
template<class TVal>
TVVec<TVal>& TVVec< TVal >::operator= ( const TVVec< TVal > &  Vec) [inline]

Definition at line 1738 of file ds.h.

                                                {
    if (this!=&Vec){XDim=Vec.XDim; YDim=Vec.YDim; ValV=Vec.ValV;} return *this;}
template<class TVal>
bool TVVec< TVal >::operator== ( const TVVec< TVal > &  Vec) const [inline]

Definition at line 1740 of file ds.h.

                                          {
    return (XDim==Vec.XDim)&&(YDim==Vec.YDim)&&(ValV==Vec.ValV);}
template<class TVal>
void TVVec< TVal >::PutAll ( const TVal &  Val) [inline]
template<class TVal>
void TVVec< TVal >::PutX ( const int &  X,
const TVal &  Val 
) [inline]

Definition at line 1767 of file ds.h.

                                          {
    for (int Y=0; Y<int(YDim); Y++){At(X, Y)=Val;}}
template<class TVal>
void TVVec< TVal >::PutXY ( const int &  X,
const int &  Y,
const TVal &  Val 
) [inline]

Definition at line 1765 of file ds.h.

{At(X, Y)=Val;}
template<class TVal>
void TVVec< TVal >::PutY ( const int &  Y,
const TVal &  Val 
) [inline]

Definition at line 1769 of file ds.h.

Referenced by TMAGFitBern::SetPhiVV().

                                          {
    for (int X=0; X<int(XDim); X++){At(X, Y)=Val;}}

Here is the caller graph for this function:

template<class TVal>
void TVVec< TVal >::Save ( TSOut SOut) const [inline]

Definition at line 1735 of file ds.h.

                               {
    XDim.Save(SOut); YDim.Save(SOut); ValV.Save(SOut);}
template<class TVal >
void TVVec< TVal >::ShuffleX ( TRnd Rnd)

Definition at line 1814 of file ds.h.

References TRnd::GetUniDevInt().

                                   {
  for (int X=0; X<XDim-1; X++){SwapX(X, X+Rnd.GetUniDevInt(XDim-X));}
}

Here is the call graph for this function:

template<class TVal >
void TVVec< TVal >::ShuffleY ( TRnd Rnd)

Definition at line 1819 of file ds.h.

References TRnd::GetUniDevInt().

                                   {
  for (int Y=0; Y<YDim-1; Y++){SwapY(Y, Y+Rnd.GetUniDevInt(YDim-Y));}
}

Here is the call graph for this function:

template<class TVal>
void TVVec< TVal >::Swap ( TVVec< TVal > &  Vec)

Definition at line 1805 of file ds.h.

References Swap(), TVVec< TVal >::ValV, TVVec< TVal >::XDim, and TVVec< TVal >::YDim.

                                      {  //J:
  if (this!=&Vec){
    ::Swap(XDim, Vec.XDim);
    ::Swap(YDim, Vec.YDim);
    ValV.Swap(Vec.ValV);
  }
}

Here is the call graph for this function:

template<class TVal >
void TVVec< TVal >::SwapX ( const int &  X1,
const int &  X2 
)

Definition at line 1793 of file ds.h.

                                                   {
  for (int Y=0; Y<int(YDim); Y++){
    TVal Val=At(X1, Y); At(X1, Y)=At(X2, Y); At(X2, Y)=Val;}
}
template<class TVal >
void TVVec< TVal >::SwapY ( const int &  Y1,
const int &  Y2 
)

Definition at line 1799 of file ds.h.

                                                   {
  for (int X=0; X<int(XDim); X++){
    TVal Val=At(X, Y1); At(X, Y1)=At(X, Y2); At(X, Y2)=Val;}
}

Member Data Documentation


The documentation for this class was generated from the following file: