Public Member Functions |
| | FullyDistSpVec () |
| | FullyDistSpVec (IT glen) |
| | FullyDistSpVec (shared_ptr< CommGrid > grid) |
| | FullyDistSpVec (shared_ptr< CommGrid > grid, IT glen) |
| | FullyDistSpVec (const FullyDistVec< IT, NT > &rhs) |
| void | stealFrom (FullyDistSpVec< IT, NT > &victim) |
| FullyDistSpVec< IT, NT > & | operator= (const FullyDistSpVec< IT, NT > &rhs) |
| FullyDistSpVec< IT, NT > & | operator= (const FullyDistVec< IT, NT > &rhs) |
| FullyDistSpVec< IT, NT > & | operator+= (const FullyDistSpVec< IT, NT > &rhs) |
| FullyDistSpVec< IT, NT > & | operator-= (const FullyDistSpVec< IT, NT > &rhs) |
| template<class HANDLER > |
| ifstream & | ReadDistribute (ifstream &infile, int master, HANDLER handler) |
| | Called on an existing object.
|
| ifstream & | ReadDistribute (ifstream &infile, int master) |
| template<class HANDLER > |
| void | SaveGathered (ofstream &outfile, int master, HANDLER handler, bool printProcSplits=false) |
| void | SaveGathered (ofstream &outfile, int master) |
| template<typename NNT > |
| | operator FullyDistSpVec< IT, NNT > () const |
| | < Type conversion operator
|
| bool | operator== (const FullyDistSpVec< IT, NT > &rhs) const |
| void | PrintInfo (string vecname) const |
| void | iota (IT globalsize, NT first) |
| FullyDistVec< IT, NT > | operator() (const FullyDistVec< IT, IT > &ri) const |
| | SpRef (expects ri to be 0-based)
|
| void | SetElement (IT indx, NT numx) |
| | Indexing is performed 0-based.
|
| void | DelElement (IT indx) |
| NT | operator[] (IT indx) |
| bool | WasFound () const |
| FullyDistSpVec< IT, IT > | sort () |
| IT | getlocnnz () const |
| IT | getnnz () const |
| void | setNumToInd () |
| template<typename _Predicate > |
| IT | Count (_Predicate pred) const |
| | Return the number of elements for which pred is true.
|
| template<typename _UnaryOperation > |
| void | Apply (_UnaryOperation __unary_op) |
| template<typename _BinaryOperation > |
| void | ApplyInd (_BinaryOperation __binary_op) |
| template<typename _BinaryOperation > |
| NT | Reduce (_BinaryOperation __binary_op, NT init) |
| template<typename OUT , typename _BinaryOperation , typename _UnaryOperation > |
| OUT | Reduce (_BinaryOperation __binary_op, OUT default_val, _UnaryOperation __unary_op) |
| void | DebugPrint () |
| shared_ptr< CommGrid > | getcommgrid () const |
Friends |
| class | FullyDistSpVec |
| class | FullyDistVec |
| class | SpParMat |
| class | SparseVectorLocalIterator |
| template<typename SR , typename IU , typename NUM , typename NUV , typename UDER > |
FullyDistSpVec< IU, typename
promote_trait< NUM, NUV >
::T_promote > | SpMV (const SpParMat< IU, NUM, UDER > &A, const FullyDistSpVec< IU, NUV > &x) |
| template<typename SR , typename IU , typename NUM , typename UDER > |
FullyDistSpVec< IU, typename
promote_trait< NUM, IU >
::T_promote > | SpMV (const SpParMat< IU, NUM, UDER > &A, const FullyDistSpVec< IU, IU > &x, bool indexisvalue) |
| template<typename VT , typename IU , typename UDER > |
| FullyDistSpVec< IU, VT > | SpMV (const SpParMat< IU, bool, UDER > &A, const FullyDistSpVec< IU, VT > &x, OptBuf< int32_t, VT > &optbuf) |
| template<typename SR , typename IVT , typename OVT , typename IU , typename NUM , typename UDER > |
| void | SpMV (const SpParMat< IU, NUM, UDER > &A, const FullyDistSpVec< IU, IVT > &x, FullyDistSpVec< IU, OVT > &y, bool indexisvalue, OptBuf< int32_t, OVT > &optbuf) |
| template<typename IU , typename NU1 , typename NU2 > |
FullyDistSpVec< IU, typename
promote_trait< NU1, NU2 >
::T_promote > | EWiseMult (const FullyDistSpVec< IU, NU1 > &V, const FullyDistVec< IU, NU2 > &W, bool exclude, NU2 zero) |
| template<typename RET , typename IU , typename NU1 , typename NU2 , typename _BinaryOperation , typename _BinaryPredicate > |
| FullyDistSpVec< IU, RET > | EWiseApply (const FullyDistSpVec< IU, NU1 > &V, const FullyDistVec< IU, NU2 > &W, _BinaryOperation _binary_op, _BinaryPredicate _doOp, bool allowVNulls, NU1 Vzero, const bool useExtendedBinOp) |
| template<typename RET , typename IU , typename NU1 , typename NU2 , typename _BinaryOperation , typename _BinaryPredicate > |
| FullyDistSpVec< IU, RET > | EWiseApply (const FullyDistSpVec< IU, NU1 > &V, const FullyDistSpVec< IU, NU2 > &W, _BinaryOperation _binary_op, _BinaryPredicate _doOp, bool allowVNulls, bool allowWNulls, NU1 Vzero, NU2 Wzero, const bool allowIntersect, const bool useExtendedBinOp) |
| template<typename IU > |
| void | RandPerm (FullyDistSpVec< IU, IU > &V) |
| template<typename IU > |
| void | RenameVertices (DistEdgeList< IU > &DEL) |
| template<typename SR , typename IU , typename OVT > |
| void | MergeContributions (FullyDistSpVec< IU, OVT > &y, int *&recvcnt, int *&rdispls, int32_t *&recvindbuf, OVT *&recvnumbuf, int rowneighs) |
| | Helper functions for sparse matrix X sparse vector.
|
| template<typename IU , typename VT > |
| void | MergeContributions (FullyDistSpVec< IU, VT > &y, int *&recvcnt, int *&rdispls, int32_t *&recvindbuf, VT *&recvnumbuf, int rowneighs) |
| template<typename IU , typename NV > |
| void | TransposeVector (MPI_Comm &World, const FullyDistSpVec< IU, NV > &x, int32_t &trxlocnz, IU &lenuntil, int32_t *&trxinds, NV *&trxnums, bool indexisvalue) |
template<class IT, class NT>
class FullyDistSpVec< IT, NT >
A sparse vector of length n (with nnz <= n of them being nonzeros) is distributed to "all the 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)=12 we use 4 processors P_00, P_01, P_10, P_11 Then P_00 owns 1,2, P_01 ow`ns 5, and so on. 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) = 20, then P_00 would own all the nonzeros and the rest will hold empry vectors Just like in SpParMat case, indices are local to processors (they belong to range [0,...,length-1] on each processor)
- Warning:
- Always create vectors with the right length, setting elements won't increase its length (similar to operator[] on std::vector)
Definition at line 70 of file FullyDistSpVec.h.
template<class IT , class NT >
SpRef (expects ri to be 0-based)
The distribution and length are inherited from ri Its zero is inherited from *this (because ri is of type IT) 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 = [4,1,5,7] is distributed as two elements per processor Then result has length 4, distrubuted two element per processor, even though 5 and 7 doesn't exist This is because we are returning a "dense" output, so the absent elements will be padded with 0
Definition at line 180 of file FullyDistSpVec.cpp.
template<class IT, class NT>
template<typename RET , typename IU , typename NU1 , typename NU2 , typename _BinaryOperation , typename _BinaryPredicate >
| FullyDistSpVec<IU,RET> EWiseApply |
( |
const FullyDistSpVec< IU, NU1 > & |
V, |
|
|
const FullyDistVec< IU, NU2 > & |
W, |
|
|
_BinaryOperation |
_binary_op, |
|
|
_BinaryPredicate |
_doOp, |
|
|
bool |
allowVNulls, |
|
|
NU1 |
Vzero, |
|
|
const bool |
useExtendedBinOp |
|
) |
| |
|
friend |
Performs an arbitrary binary operation _binary_op on the corresponding elements of two vectors with the result stored in a return vector ret. The binary operatiation is only performed if the binary predicate _doOp returns true for those elements. Otherwise the binary operation is not performed and ret does not contain an element at that position. More formally the operation is defined as: if (_doOp(V[i], W[i])) ret[i] = _binary_op(V[i], W[i]) else // ret[i] is not set Hence _doOp can be used to implement a filter on either of the vectors.
The above is only defined if both V[i] and W[i] exist (i.e. an intersection). To allow a union operation (ex. when V[i] doesn't exist but W[i] does) the allowVNulls flag is set to true and the Vzero argument is used as the missing V[i] value.
The type of each element of ret must not necessarily be related to the types of V or W, so the return type must be explicitly specified as a template parameter: FullyDistSpVec<int, double> r = EWiseApply<double>(V, W, plus, retTrue, false, 0)
Definition at line 1285 of file ParFriends.h.
template<class IT, class NT>
template<typename RET , typename IU , typename NU1 , typename NU2 , typename _BinaryOperation , typename _BinaryPredicate >
| FullyDistSpVec<IU,RET> EWiseApply |
( |
const FullyDistSpVec< IU, NU1 > & |
V, |
|
|
const FullyDistSpVec< IU, NU2 > & |
W, |
|
|
_BinaryOperation |
_binary_op, |
|
|
_BinaryPredicate |
_doOp, |
|
|
bool |
allowVNulls, |
|
|
bool |
allowWNulls, |
|
|
NU1 |
Vzero, |
|
|
NU2 |
Wzero, |
|
|
const bool |
allowIntersect, |
|
|
const bool |
useExtendedBinOp |
|
) |
| |
|
friend |
Performs an arbitrary binary operation _binary_op on the corresponding elements of two vectors with the result stored in a return vector ret. The binary operatiation is only performed if the binary predicate _doOp returns true for those elements. Otherwise the binary operation is not performed and ret does not contain an element at that position. More formally the operation is defined as: if (_doOp(V[i], W[i])) ret[i] = _binary_op(V[i], W[i]) else // ret[i] is not set Hence _doOp can be used to implement a filter on either of the vectors.
The above is only defined if both V[i] and W[i] exist (i.e. an intersection). To allow a union operation (ex. when V[i] doesn't exist but W[i] does) the allowVNulls flag is set to true and the Vzero argument is used as the missing V[i] value. !allowVNulls && !allowWNulls => intersection !allowVNulls && allowWNulls => operate on all elements of V allowVNulls && !allowWNulls => operate on all elements of W allowVNulls && allowWNulls => union
The type of each element of ret must not necessarily be related to the types of V or W, so the return type must be explicitly specified as a template parameter: FullyDistSpVec<int, double> r = EWiseApply<double>(V, W, plus, retTrue, false, 0, false, 0)
Definition at line 1375 of file ParFriends.h.