COMBINATORIAL_BLAS  1.6
SpTuples< IT, NT > Class Template Reference

#include <Friends.h>

Inheritance diagram for SpTuples< IT, NT >:
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, tuple< IT, IT, NT > *mytuples, bool sorted=false)
 
 SpTuples (int64_t maxnnz, IT nRow, IT nCol, vector< IT > &edges, bool removeloops=true)
 
 SpTuples (int64_t size, IT nRow, IT nCol, StackEntry< NT, 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 (vector< NT > loopvals, bool replaceExisting=false)
 
IT RemoveLoops ()
 
pair< IT, IT > RowLimits ()
 
pair< IT, IT > ColLimits ()
 
tuple< IT, IT, NT > front ()
 
tuple< IT, IT, NT > back ()
 
ofstream & putstream (ofstream &outfile) const
 
ofstream & put (ofstream &outfile) const
 
ifstream & getstream (ifstream &infile)
 
ifstream & get (ifstream &infile)
 
bool isZero () const
 
IT getnrow () const
 
IT getncol () const
 
int64_t getnnz () const
 
void PrintInfo ()
 
- Public Member Functions inherited from SpMat< IT, NT, SpTuples< IT, NT > >
void Create (const vector< IT > &essentials)
 
void Create (IT size, IT nRow, IT nCol, tuple< IT, IT, NT > *mytuples)
 
SpMat< IT, NT, SpTuples< IT, NT > > operator() (const vector< IT > &ri, const 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
 
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
 
ofstream & put (ofstream &outfile) const
 
ifstream & get (ifstream &infile)
 
bool isZero () const
 
IT getnrow () const
 
IT getncol () const
 
IT getnnz () const
 

Public Attributes

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 vector< SpTuples< IU, NU > *> &ArrSpTups, IU mstar, IU nstar, bool delarrs)
 
template<typename SR , typename IU , typename NU >
SpTuples< IU, NU > * MergeAllRec (const vector< SpTuples< IU, NU > *> &ArrSpTups, IU mstar, IU nstar)
 

Detailed Description

template<class IT, class NT>
class 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 47 of file Friends.h.

Constructor & Destructor Documentation

◆ SpTuples() [1/6]

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

Definition at line 36 of file SpTuples.cpp.

◆ SpTuples() [2/6]

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

Definition at line 50 of file SpTuples.cpp.

◆ SpTuples() [3/6]

template<class IT , class NT >
SpTuples< IT, NT >::SpTuples ( int64_t  maxnnz,
IT  nRow,
IT  nCol,
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 68 of file SpTuples.cpp.

◆ SpTuples() [4/6]

template<class IT , class NT >
SpTuples< IT, NT >::SpTuples ( int64_t  size,
IT  nRow,
IT  nCol,
StackEntry< NT, 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 128 of file SpTuples.cpp.

◆ SpTuples() [5/6]

template<class IT , class NT >
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 161 of file SpTuples.cpp.

◆ SpTuples() [6/6]

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

Constructor for converting SpDCCols matrix -> SpTuples.

Definition at line 172 of file SpTuples.cpp.

◆ ~SpTuples()

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

Definition at line 146 of file SpTuples.cpp.

Member Function Documentation

◆ AddLoops() [1/2]

template<class IT, class NT>
IT 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 106 of file SpTuples.h.

◆ AddLoops() [2/2]

template<class IT, class NT>
IT SpTuples< IT, NT >::AddLoops ( 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 149 of file SpTuples.h.

◆ back()

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

Definition at line 236 of file SpTuples.h.

◆ colindex() [1/2]

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

Definition at line 74 of file SpTuples.h.

◆ colindex() [2/2]

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

Definition at line 78 of file SpTuples.h.

◆ ColLimits()

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

Definition at line 223 of file SpTuples.h.

◆ front()

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

Definition at line 235 of file SpTuples.h.

◆ get()

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

Definition at line 250 of file SpTuples.h.

◆ getncol()

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

Definition at line 255 of file SpTuples.h.

◆ getnnz()

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

Definition at line 256 of file SpTuples.h.

◆ getnrow()

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

Definition at line 254 of file SpTuples.h.

◆ getstream()

template<class IT , class NT >
ifstream & SpTuples< IT, NT >::getstream ( 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 263 of file SpTuples.cpp.

◆ isZero()

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

Definition at line 253 of file SpTuples.h.

◆ numvalue() [1/2]

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

Definition at line 75 of file SpTuples.h.

◆ numvalue() [2/2]

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

Definition at line 79 of file SpTuples.h.

◆ operator=()

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

Definition at line 202 of file SpTuples.cpp.

◆ PrintInfo()

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

Definition at line 306 of file SpTuples.cpp.

◆ put()

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

Definition at line 246 of file SpTuples.h.

◆ putstream()

template<class IT , class NT >
ofstream & SpTuples< IT, NT >::putstream ( 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 294 of file SpTuples.cpp.

◆ RemoveDuplicates()

template<class IT , class NT >
template<typename BINFUNC >
void 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 233 of file SpTuples.cpp.

◆ RemoveLoops()

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

Definition at line 188 of file SpTuples.h.

◆ rowindex() [1/2]

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

Definition at line 73 of file SpTuples.h.

◆ rowindex() [2/2]

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

Definition at line 77 of file SpTuples.h.

◆ RowLimits()

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

Definition at line 211 of file SpTuples.h.

◆ SortColBased()

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

Definition at line 95 of file SpTuples.h.

◆ SortRowBased()

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

Definition at line 85 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 vector< SpTuples< IU, NU > *> &  ArrSpTups,
IU  mstar = 0,
IU  nstar = 0,
bool  delarrs = false 
)
friend

Definition at line 604 of file Friends.h.

◆ MergeAllRec

template<class IT, class NT>
template<typename SR , typename IU , typename NU >
SpTuples<IU,NU>* MergeAllRec ( const 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 275 of file SpTuples.h.

◆ SpDCCols

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

Definition at line 272 of file SpTuples.h.

Member Data Documentation

◆ tuples

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

Definition at line 259 of file SpTuples.h.


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