COMBINATORIAL_BLAS  1.6
combblas::SpTuples< IT, NT > Class Template Reference

#include <Friends.h>

Inheritance diagram for combblas::SpTuples< IT, NT >:
combblas::SpMat< IT, NT, SpTuples< IT, NT > >

Public Member Functions

 SpTuples (int64_t size, IT nRow, IT nCol)
 
 SpTuples (int64_t size, IT nRow, IT nCol, std::tuple< IT, IT, NT > *mytuples, bool sorted=false, bool isOpNew=false)
 
 SpTuples (int64_t maxnnz, IT nRow, IT nCol, std::vector< IT > &edges, bool removeloops=true)
 
 SpTuples (int64_t size, IT nRow, IT nCol, StackEntry< NT, std::pair< IT, IT > > *&multstack)
 
 SpTuples (const SpTuples< IT, NT > &rhs)
 
 SpTuples (const SpDCCols< IT, NT > &rhs)
 Constructor for converting SpDCCols matrix -> SpTuples. More...
 
 ~SpTuples ()
 
SpTuples< IT, NT > & operator= (const SpTuples< IT, NT > &rhs)
 
IT & rowindex (IT i)
 
IT & colindex (IT i)
 
NT & numvalue (IT i)
 
IT rowindex (IT i) const
 
IT colindex (IT i) const
 
NT numvalue (IT i) const
 
template<typename BINFUNC >
void RemoveDuplicates (BINFUNC BinOp)
 
void SortRowBased ()
 
void SortColBased ()
 
IT AddLoops (NT loopval, bool replaceExisting=false)
 
IT AddLoops (std::vector< NT > loopvals, bool replaceExisting=false)
 
IT RemoveLoops ()
 
std::pair< IT, IT > RowLimits ()
 
std::pair< IT, IT > ColLimits ()
 
std::tuple< IT, IT, NT > front ()
 
std::tuple< IT, IT, NT > back ()
 
std::ofstream & putstream (std::ofstream &outfile) const
 
std::ofstream & put (std::ofstream &outfile) const
 
std::ifstream & getstream (std::ifstream &infile)
 
std::ifstream & get (std::ifstream &infile)
 
bool isZero () const
 
IT getnrow () const
 
IT getncol () const
 
int64_t getnnz () const
 
void PrintInfo ()
 
- Public Member Functions inherited from combblas::SpMat< IT, NT, SpTuples< IT, NT > >
void Create (const std::vector< IT > &essentials)
 
void Create (IT size, IT nRow, IT nCol, std::tuple< IT, IT, NT > *mytuples)
 
SpMat< IT, NT, SpTuples< IT, NT > > operator() (const std::vector< IT > &ri, const std::vector< IT > &ci) const
 
void SpGEMM (SpMat< IT, NT, SpTuples< IT, NT > > &A, SpMat< IT, NT, SpTuples< IT, NT > > &B, bool isAT, bool isBT)
 
void Split (SpMat< IT, NT, SpTuples< IT, NT > > &partA, SpMat< IT, NT, SpTuples< IT, NT > > &partB)
 
void Merge (SpMat< IT, NT, SpTuples< IT, NT > > &partA, SpMat< IT, NT, SpTuples< IT, NT > > &partB)
 
Arr< IT, NT > GetArrays () const
 
std::vector< IT > GetEssentials () const
 
auto GetInternal () const
 
auto GetInternal (int i) const
 
int getnsplit () const
 
void Transpose ()
 
auto begcol ()
 
auto begcol (int i)
 
auto endcol ()
 
auto endcol (int i)
 
auto begnz (const typename X::SpColIter &ccol)
 
auto begnz (const typename X::SpColIter &ccol, int i)
 
auto endnz (const typename X::SpColIter &ccol)
 
auto endnz (const typename X::SpColIter &ccol, int i)
 
bool operator== (const SpMat< IT, NT, SpTuples< IT, NT > > &rhs) const
 
std::ofstream & put (std::ofstream &outfile) const
 
std::ifstream & get (std::ifstream &infile)
 
bool isZero () const
 
IT getnrow () const
 
IT getncol () const
 
IT getnnz () const
 

Public Attributes

std::tuple< IT, IT, NT > * tuples
 

Friends

template<class IU , class NU >
class SpDCCols
 
template<class IU , class NU >
class SpCCols
 
template<typename SR , typename IU , typename NU >
SpTuples< IU, NU > MergeAll (const std::vector< SpTuples< IU, NU > *> &ArrSpTups, IU mstar, IU nstar, bool delarrs)
 
template<typename SR , typename IU , typename NU >
SpTuples< IU, NU > * MergeAllRec (const std::vector< SpTuples< IU, NU > *> &ArrSpTups, IU mstar, IU nstar)
 

Detailed Description

template<class IT, class NT>
class combblas::SpTuples< IT, NT >

Triplets are represented using the boost::tuple class of the Boost library Number of entries are 64-bit addressible, but each entry is only <class it>=""> addressible Therefore, size is int64_t but nrows/ncols (representing range of first two entries in tuple) is of type IT

Remarks
Indices start from 0 in this class
Sorted with respect to columns (Column-sorted triples)

Definition at line 48 of file Friends.h.

Constructor & Destructor Documentation

◆ SpTuples() [1/6]

template<class IT , class NT >
combblas::SpTuples< IT, NT >::SpTuples ( int64_t  size,
IT  nRow,
IT  nCol 
)

Definition at line 37 of file SpTuples.cpp.

◆ SpTuples() [2/6]

template<class IT , class NT >
combblas::SpTuples< IT, NT >::SpTuples ( int64_t  size,
IT  nRow,
IT  nCol,
std::tuple< IT, IT, NT > *  mytuples,
bool  sorted = false,
bool  isOpNew = false 
)

Definition at line 52 of file SpTuples.cpp.

◆ SpTuples() [3/6]

template<class IT , class NT >
combblas::SpTuples< IT, NT >::SpTuples ( int64_t  maxnnz,
IT  nRow,
IT  nCol,
std::vector< IT > &  edges,
bool  removeloops = true 
)

Generate a SpTuples object from an edge list

Parameters
[in,out]edgesedge list that might contain duplicate edges. freed upon return Semantics differ depending on the object created: NT=bool: duplicates are ignored NT='countable' (such as short,int): duplicated as summed to keep count

Definition at line 70 of file SpTuples.cpp.

◆ SpTuples() [4/6]

template<class IT , class NT >
combblas::SpTuples< IT, NT >::SpTuples ( int64_t  size,
IT  nRow,
IT  nCol,
StackEntry< NT, std::pair< IT, IT > > *&  multstack 
)

Generate a SpTuples object from StackEntry array, then delete that array

Parameters
[in]multstack{value-key pairs where keys are pair<col_ind, row_ind> sorted lexicographically}
Remarks
Since input is column sorted, the tuples are automatically generated in that way too

Definition at line 132 of file SpTuples.cpp.

◆ SpTuples() [5/6]

template<class IT , class NT >
combblas::SpTuples< IT, NT >::SpTuples ( const SpTuples< IT, NT > &  rhs)

Hint1: copy constructor (constructs a new object. i.e. this is NEVER called on an existing object) Hint2: Base's default constructor is called under the covers Normally Base's copy constructor should be invoked but it doesn't matter here as Base has no data members

Definition at line 168 of file SpTuples.cpp.

◆ SpTuples() [6/6]

template<class IT , class NT >
combblas::SpTuples< IT, NT >::SpTuples ( const SpDCCols< IT, NT > &  rhs)

Constructor for converting SpDCCols matrix -> SpTuples.

Definition at line 180 of file SpTuples.cpp.

◆ ~SpTuples()

template<class IT , class NT >
combblas::SpTuples< IT, NT >::~SpTuples ( )

Definition at line 151 of file SpTuples.cpp.

Member Function Documentation

◆ AddLoops() [1/2]

template<class IT, class NT>
IT combblas::SpTuples< IT, NT >::AddLoops ( NT  loopval,
bool  replaceExisting = false 
)
inline
Precondition
{should only be called on diagonal processors (others will add non-loop nonzeros)}
{both the implementation and its semantics is meaningless for non-square matrices}

Definition at line 107 of file SpTuples.h.

◆ AddLoops() [2/2]

template<class IT, class NT>
IT combblas::SpTuples< IT, NT >::AddLoops ( std::vector< NT >  loopvals,
bool  replaceExisting = false 
)
inline
Precondition
{should only be called on diagonal processors (others will add non-loop nonzeros)}
{both the implementation and its semantics is meaningless for non-square matrices}

Definition at line 154 of file SpTuples.h.

◆ back()

template<class IT, class NT>
std::tuple<IT, IT, NT> combblas::SpTuples< IT, NT >::back ( )
inline

Definition at line 249 of file SpTuples.h.

◆ colindex() [1/2]

template<class IT, class NT>
IT& combblas::SpTuples< IT, NT >::colindex ( IT  i)
inline

Definition at line 75 of file SpTuples.h.

◆ colindex() [2/2]

template<class IT, class NT>
IT combblas::SpTuples< IT, NT >::colindex ( IT  i) const
inline

Definition at line 79 of file SpTuples.h.

◆ ColLimits()

template<class IT, class NT>
std::pair<IT,IT> combblas::SpTuples< IT, NT >::ColLimits ( )
inline

Definition at line 236 of file SpTuples.h.

◆ front()

template<class IT, class NT>
std::tuple<IT, IT, NT> combblas::SpTuples< IT, NT >::front ( )
inline

Definition at line 248 of file SpTuples.h.

◆ get()

template<class IT, class NT>
std::ifstream& combblas::SpTuples< IT, NT >::get ( std::ifstream &  infile)
inline

Definition at line 263 of file SpTuples.h.

◆ getncol()

template<class IT, class NT>
IT combblas::SpTuples< IT, NT >::getncol ( ) const
inline

Definition at line 268 of file SpTuples.h.

◆ getnnz()

template<class IT, class NT>
int64_t combblas::SpTuples< IT, NT >::getnnz ( ) const
inline

Definition at line 269 of file SpTuples.h.

◆ getnrow()

template<class IT, class NT>
IT combblas::SpTuples< IT, NT >::getnrow ( ) const
inline

Definition at line 267 of file SpTuples.h.

◆ getstream()

template<class IT , class NT >
std::ifstream & combblas::SpTuples< IT, NT >::getstream ( std::ifstream &  infile)

Loads a triplet matrix from infile

Remarks
Assumes matlab type indexing for the input (i.e. indices start from 1)

Definition at line 278 of file SpTuples.cpp.

◆ isZero()

template<class IT, class NT>
bool combblas::SpTuples< IT, NT >::isZero ( ) const
inline

Definition at line 266 of file SpTuples.h.

◆ numvalue() [1/2]

template<class IT, class NT>
NT& combblas::SpTuples< IT, NT >::numvalue ( IT  i)
inline

Definition at line 76 of file SpTuples.h.

◆ numvalue() [2/2]

template<class IT, class NT>
NT combblas::SpTuples< IT, NT >::numvalue ( IT  i) const
inline

Definition at line 80 of file SpTuples.h.

◆ operator=()

template<class IT , class NT >
SpTuples< IT, NT > & combblas::SpTuples< IT, NT >::operator= ( const SpTuples< IT, NT > &  rhs)

Definition at line 210 of file SpTuples.cpp.

◆ PrintInfo()

template<class IT , class NT >
void combblas::SpTuples< IT, NT >::PrintInfo ( )

Definition at line 321 of file SpTuples.cpp.

◆ put()

template<class IT, class NT>
std::ofstream& combblas::SpTuples< IT, NT >::put ( std::ofstream &  outfile) const
inline

Definition at line 259 of file SpTuples.h.

◆ putstream()

template<class IT , class NT >
std::ofstream & combblas::SpTuples< IT, NT >::putstream ( std::ofstream &  outfile) const

Output to a triplets file

Remarks
Uses matlab type indexing for the output (i.e. indices start from 1)

Definition at line 309 of file SpTuples.cpp.

◆ RemoveDuplicates()

template<class IT , class NT >
template<typename BINFUNC >
void combblas::SpTuples< IT, NT >::RemoveDuplicates ( BINFUNC  BinOp)
Precondition
{The object is either column-sorted or row-sorted, either way the identical entries will be consecutive}

Definition at line 244 of file SpTuples.cpp.

◆ RemoveLoops()

template<class IT, class NT>
IT combblas::SpTuples< IT, NT >::RemoveLoops ( )
inline
Precondition
{should only be called on diagonal processors (others will remove non-loop nonzeros)}

Definition at line 197 of file SpTuples.h.

◆ rowindex() [1/2]

template<class IT, class NT>
IT& combblas::SpTuples< IT, NT >::rowindex ( IT  i)
inline

Definition at line 74 of file SpTuples.h.

◆ rowindex() [2/2]

template<class IT, class NT>
IT combblas::SpTuples< IT, NT >::rowindex ( IT  i) const
inline

Definition at line 78 of file SpTuples.h.

◆ RowLimits()

template<class IT, class NT>
std::pair<IT,IT> combblas::SpTuples< IT, NT >::RowLimits ( )
inline

Definition at line 224 of file SpTuples.h.

◆ SortColBased()

template<class IT, class NT>
void combblas::SpTuples< IT, NT >::SortColBased ( )
inline

Definition at line 96 of file SpTuples.h.

◆ SortRowBased()

template<class IT, class NT>
void combblas::SpTuples< IT, NT >::SortRowBased ( )
inline

Definition at line 86 of file SpTuples.h.

Friends And Related Function Documentation

◆ MergeAll

template<class IT, class NT>
template<typename SR , typename IU , typename NU >
SpTuples<IU,NU> MergeAll ( const std::vector< SpTuples< IU, NU > *> &  ArrSpTups,
IU  mstar = 0,
IU  nstar = 0,
bool  delarrs = false 
)
friend

Definition at line 605 of file Friends.h.

◆ MergeAllRec

template<class IT, class NT>
template<typename SR , typename IU , typename NU >
SpTuples<IU,NU>* MergeAllRec ( const std::vector< SpTuples< IU, NU > *> &  ArrSpTups,
IU  mstar,
IU  nstar 
)
friend

◆ SpCCols

template<class IT, class NT>
template<class IU , class NU >
friend class SpCCols
friend

Definition at line 289 of file SpTuples.h.

◆ SpDCCols

template<class IT, class NT>
template<class IU , class NU >
friend class SpDCCols
friend

Definition at line 286 of file SpTuples.h.

Member Data Documentation

◆ tuples

template<class IT, class NT>
std::tuple<IT, IT, NT>* combblas::SpTuples< IT, NT >::tuples

Definition at line 272 of file SpTuples.h.


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