COMBINATORIAL_BLAS  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Private Attributes | Friends | List of all members
SpParVec< IT, NT > Class Template Reference

#include <DenseParVec.h>

Public Member Functions

 SpParVec ()
 
 SpParVec (IT loclength)
 
 SpParVec (shared_ptr< CommGrid > grid)
 
 SpParVec (shared_ptr< CommGrid > grid, IT loclength)
 
void stealFrom (SpParVec< IT, NT > &victim)
 
SpParVec< IT, NT > & operator+= (const SpParVec< IT, NT > &rhs)
 
SpParVec< IT, NT > & operator-= (const SpParVec< IT, NT > &rhs)
 
ifstream & ReadDistribute (ifstream &infile, int master)
 Called on an existing object. More...
 
template<typename NNT >
 operator SpParVec< IT, NNT > () const
 < Type conversion operator More...
 
void PrintInfo (string vecname) const
 
void iota (IT size, NT first)
 
SpParVec< IT, NT > operator() (const SpParVec< IT, IT > &ri) const
 SpRef (expects NT of ri to be 0-based) More...
 
void SetElement (IT indx, NT numx)
 
NT operator[] (IT indx) const
 
SpParVec< IT, IT > sort ()
 
IT getlocnnz () const
 
IT getnnz () const
 
IT getTypicalLocLength () const
 
IT getTotalLength (MPI_Comm &comm) const
 
IT getTotalLength () const
 
void setNumToInd ()
 
template<typename _UnaryOperation >
void Apply (_UnaryOperation __unary_op)
 
template<typename _BinaryOperation >
NT Reduce (_BinaryOperation __binary_op, NT init)
 
void DebugPrint ()
 
shared_ptr< CommGridgetcommgrid ()
 

Public Attributes

NT NOT_FOUND
 

Private Attributes

shared_ptr< CommGridcommGrid
 
vector< IT > ind
 
vector< NT > num
 
IT length
 
bool diagonal
 

Friends

template<class IU , class NU >
class SpParVec
 
template<class IU , class NU >
class DenseParVec
 
template<class IU , class NU , class UDER >
class SpParMat
 
template<typename SR , typename IU , typename NUM , typename NUV , typename UDER >
SpParVec< IU, typename
promote_trait< NUM, NUV >
::T_promote > 
SpMV (const SpParMat< IU, NUM, UDER > &A, const SpParVec< IU, NUV > &x)
 
template<typename IU , typename NU1 , typename NU2 >
SpParVec< IU, typename
promote_trait< NU1, NU2 >
::T_promote > 
EWiseMult (const SpParVec< IU, NU1 > &V, const DenseParVec< IU, NU2 > &W, bool exclude, NU2 zero)
 
template<typename IU >
void RandPerm (SpParVec< IU, IU > &V)
 
template<typename IU >
void RenameVertices (DistEdgeList< IU > &DEL)
 

Detailed Description

template<class IT, class NT>
class SpParVec< IT, NT >

A sparse vector of length n (with nnz <= n of them being nonzeros) is distributed to diagonal processors in a way that respects ordering of the nonzero indices Example: x = [5,1,6,2,9] for nnz(x)=5 and length(x)=10 we use 4 processors P_00, P_01, P_10, P_11 Then P_00 owns 1,2 and P_11 owns rest In the case of A(v,w) type sparse matrix indexing, this doesn't matter because n = nnz After all, A(v,w) will have dimensions length(v) x length (w) v and w will be of numerical type (NT) "int" and their indices (IT) will be consecutive integers It is possibly that nonzero counts are distributed unevenly Example: x=[1,2,3,4,5] and length(x) = 10, then P_00 would own all the nonzeros and P_11 would hold an empty vector Just like in SpParMat case, indices are local to processors (they belong to range [0,...,length-1] on each processor)

TODO: Instead of repeated calls to "DiagWorld", this class should be oblivious to the communicator It should just distribute the vector to the MPI::IntraComm that it owns, whether diagonal or whole

Definition at line 44 of file DenseParVec.h.

Constructor & Destructor Documentation

template<class IT , class NT >
SpParVec< IT, NT >::SpParVec ( )

Definition at line 32 of file SpParVec.cpp.

template<class IT , class NT >
SpParVec< IT, NT >::SpParVec ( IT  loclength)

Definition at line 43 of file SpParVec.cpp.

template<class IT , class NT >
SpParVec< IT, NT >::SpParVec ( shared_ptr< CommGrid grid)

Definition at line 8 of file SpParVec.cpp.

template<class IT , class NT >
SpParVec< IT, NT >::SpParVec ( shared_ptr< CommGrid grid,
IT  loclength 
)

Definition at line 17 of file SpParVec.cpp.

Member Function Documentation

template<class IT, class NT>
template<typename _UnaryOperation >
void SpParVec< IT, NT >::Apply ( _UnaryOperation  __unary_op)
inline

Definition at line 104 of file SpParVec.h.

template<class IT , class NT >
void SpParVec< IT, NT >::DebugPrint ( )

Definition at line 640 of file SpParVec.cpp.

template<class IT, class NT>
shared_ptr<CommGrid> SpParVec< IT, NT >::getcommgrid ( )
inline

Definition at line 113 of file SpParVec.h.

template<class IT, class NT>
IT SpParVec< IT, NT >::getlocnnz ( ) const
inline

Definition at line 71 of file SpParVec.h.

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

Definition at line 76 of file SpParVec.h.

template<class IT , class NT >
IT SpParVec< IT, NT >::getTotalLength ( MPI_Comm &  comm) const

Definition at line 578 of file SpParVec.cpp.

template<class IT, class NT>
IT SpParVec< IT, NT >::getTotalLength ( ) const
inline

Definition at line 86 of file SpParVec.h.

template<class IT , class NT >
IT SpParVec< IT, NT >::getTypicalLocLength ( ) const

Definition at line 589 of file SpParVec.cpp.

template<class IT , class NT >
void SpParVec< IT, NT >::iota ( IT  size,
NT  first 
)

Definition at line 252 of file SpParVec.cpp.

template<class IT, class NT>
template<typename NNT >
SpParVec< IT, NT >::operator SpParVec< IT, NNT > ( ) const
inline

< Type conversion operator

Definition at line 53 of file SpParVec.h.

template<class IT , class NT >
SpParVec< IT, NT > SpParVec< IT, NT >::operator() ( const SpParVec< IT, IT > &  ri) const

SpRef (expects NT of ri to be 0-based)

The distribution and length are inherited from ri Example: This is [{1,n1},{4,n4},{7,n7},{8,n8},{9,n9}] with P_00 owning {1,4} and P_11 rest Assume ri = [{1,4},{2,1}] is distributed as one element per processor Then result has length 2, distrubuted one element per processor TODO: Indexing (with this given semantics) would just work with the prototype operator() (const DenseParVec<IT,IT> & ri) because this code makes no reference to ri.ind()

Definition at line 158 of file SpParVec.cpp.

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

Definition at line 316 of file SpParVec.cpp.

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

Definition at line 381 of file SpParVec.cpp.

template<class IT , class NT >
NT SpParVec< IT, NT >::operator[] ( IT  indx) const

Definition at line 69 of file SpParVec.cpp.

template<class IT , class NT >
void SpParVec< IT, NT >::PrintInfo ( string  vecname) const

Definition at line 627 of file SpParVec.cpp.

template<class IT , class NT >
ifstream & SpParVec< IT, NT >::ReadDistribute ( ifstream &  infile,
int  master 
)

Called on an existing object.

Definition at line 447 of file SpParVec.cpp.

template<class IT , class NT >
template<typename _BinaryOperation >
NT SpParVec< IT, NT >::Reduce ( _BinaryOperation  __binary_op,
NT  init 
)

Definition at line 615 of file SpParVec.cpp.

template<class IT , class NT >
void SpParVec< IT, NT >::SetElement ( IT  indx,
NT  numx 
)

Performs almost no communication other than getnnz() Indexing is performed 0-based

Definition at line 112 of file SpParVec.cpp.

template<class IT, class NT>
void SpParVec< IT, NT >::setNumToInd ( )
inline

Definition at line 88 of file SpParVec.h.

template<class IT , class NT >
SpParVec< IT, IT > SpParVec< IT, NT >::sort ( )

Definition at line 271 of file SpParVec.cpp.

template<class IT , class NT >
void SpParVec< IT, NT >::stealFrom ( SpParVec< IT, NT > &  victim)

like operator=, but instead of making a deep copy it just steals the contents. Useful for places where the "victim" will be distroyed immediately after the call.

Definition at line 59 of file SpParVec.cpp.

Friends And Related Function Documentation

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

Definition at line 126 of file SpParVec.h.

template<class IT, class NT>
template<typename IU , typename NU1 , typename NU2 >
SpParVec<IU,typename promote_trait<NU1,NU2>::T_promote> EWiseMult ( const SpParVec< IU, NU1 > &  V,
const DenseParVec< IU, NU2 > &  W,
bool  exclude,
NU2  zero 
)
friend

if exclude is true, then we prune all entries W[i] != zero from V if exclude is false, then we perform a proper elementwise multiplication

Definition at line 1155 of file ParFriends.h.

template<class IT, class NT>
template<typename IU >
void RandPerm ( SpParVec< IU, IU > &  V)
friend

Definition at line 691 of file ParFriendsExt.h.

template<class IT, class NT>
template<typename IU >
void RenameVertices ( DistEdgeList< IU > &  DEL)
friend

Rename vertices globally. You first need to do create a random permutation distributed on all processors. Then the p round robin algorithm will do the renaming: For all processors P(i,i) Broadcast local_p to all p processors For j= i*N/p to min((i+1)*N/p, N) Rename the all j's with local_p(j) inside the edgelist (and mark them "renamed" so that yeach vertex id is renamed only once)

Definition at line 357 of file DistEdgeList.cpp.

template<class IT, class NT>
template<typename SR , typename IU , typename NUM , typename NUV , typename UDER >
SpParVec<IU,typename promote_trait<NUM,NUV>::T_promote> SpMV ( const SpParMat< IU, NUM, UDER > &  A,
const SpParVec< IU, NUV > &  x 
)
friend

Definition at line 800 of file ParFriendsExt.h.

template<class IT, class NT>
template<class IU , class NU , class UDER >
friend class SpParMat
friend

Definition at line 129 of file SpParVec.h.

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

Definition at line 123 of file SpParVec.h.

Member Data Documentation

template<class IT, class NT>
shared_ptr<CommGrid> SpParVec< IT, NT >::commGrid
private

Definition at line 116 of file SpParVec.h.

template<class IT, class NT>
bool SpParVec< IT, NT >::diagonal
private

Definition at line 120 of file SpParVec.h.

template<class IT, class NT>
vector< IT > SpParVec< IT, NT >::ind
private

Definition at line 117 of file SpParVec.h.

template<class IT, class NT>
IT SpParVec< IT, NT >::length
private

Definition at line 119 of file SpParVec.h.

template<class IT, class NT>
NT SpParVec< IT, NT >::NOT_FOUND

Definition at line 114 of file SpParVec.h.

template<class IT, class NT>
vector< NT > SpParVec< IT, NT >::num
private

Definition at line 118 of file SpParVec.h.


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