SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TSparseOps< TKey, TDat > Class Template Reference

#include <linalg.h>

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 
)
inlinestatic

Definition at line 548 of file linalg.h.

548  {
549  DstV.Clr();
550  const int Src1Len = SrcV1.Len();
551  const int Src2Len = SrcV2.Len();
552  int Src1N = 0, Src2N = 0;
553  while (Src1N < Src1Len && Src2N < Src2Len) {
554  if (SrcV1[Src1N].Key < SrcV2[Src2N].Key) {
555  DstV.Add(SrcV1[Src1N]); Src1N++;
556  } else if (SrcV1[Src1N].Key > SrcV2[Src2N].Key) {
557  DstV.Add(SrcV2[Src2N]); Src2N++;
558  } else {
559  DstV.Add(TKeyDat<TKey, TDat>(SrcV1[Src1N].Key, SrcV1[Src1N].Dat + SrcV2[Src2N].Dat));
560  Src1N++; Src2N++;
561  }
562  }
563  while (Src1N < Src1Len) { DstV.Add(SrcV1[Src1N]); Src1N++; }
564  while (Src2N < Src2Len) { DstV.Add(SrcV2[Src2N]); Src2N++; }
565  }
Definition: ds.h:345

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