SNAP Library 2.2, Developer Reference  2014-03-11 19:15:55
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
TSparseOps< TKey, TDat > Class Template Reference

#include <linalg.h>

List of all members.

Static Public Member Functions

static void SparseMerge (const TKeyDatV &SrcV1, const TKeyDatV &SrcV2, TKeyDatV &DstV)

Private Types

typedef TVec< TKeyDat< TKey,
TDat > > 
TKeyDatV

Detailed Description

template<class TKey, class TDat>
class TSparseOps< TKey, TDat >

Definition at line 544 of file linalg.h.


Member Typedef Documentation

template<class TKey , class TDat >
typedef TVec<TKeyDat<TKey, TDat> > TSparseOps< TKey, TDat >::TKeyDatV [private]

Definition at line 546 of file linalg.h.


Member Function Documentation

template<class TKey , class TDat >
static void TSparseOps< TKey, TDat >::SparseMerge ( const TKeyDatV SrcV1,
const TKeyDatV SrcV2,
TKeyDatV DstV 
) [inline, static]

Definition at line 548 of file linalg.h.

References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Clr(), and TVec< TVal, TSizeTy >::Len().

Referenced by TLinAlg::AddVec().

                                                                                              {
                DstV.Clr();
                const int Src1Len = SrcV1.Len();
                const int Src2Len = SrcV2.Len();
                int Src1N = 0, Src2N = 0;
                while (Src1N < Src1Len && Src2N < Src2Len) {
                        if (SrcV1[Src1N].Key < SrcV2[Src2N].Key) { 
                                DstV.Add(SrcV1[Src1N]); Src1N++;
                        } else if (SrcV1[Src1N].Key > SrcV2[Src2N].Key) { 
                                DstV.Add(SrcV2[Src2N]); Src2N++;
                        } else { 
                                DstV.Add(TKeyDat<TKey, TDat>(SrcV1[Src1N].Key, SrcV1[Src1N].Dat + SrcV2[Src2N].Dat));
                                Src1N++;  Src2N++; 
                        }
                }
                while (Src1N < Src1Len) { DstV.Add(SrcV1[Src1N]); Src1N++; }
                while (Src2N < Src2Len) { DstV.Add(SrcV2[Src2N]); Src2N++; }
        }

Here is the call graph for this function:

Here is the caller graph for this function:


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