30#ifndef _FULLY_DIST_VEC_H_
31#define _FULLY_DIST_VEC_H_
46template <
class IT,
class NT>
49template <
class IT,
class NT,
class DER>
55template <
class IU,
class NU>
56class DenseVectorLocalIterator;
60template <
class IT,
class NT>
61class FullyDistVec:
public FullyDist<IT,NT, typename combblas::disable_if< combblas::is_boolean<NT>::value, NT >::type >
69 FullyDistVec (
const std::vector<NT> & fillarr, std::shared_ptr<CommGrid> grid );
72 template <
class ITRHS,
class NTRHS>
80 template <
typename c,
typename t>
88 template <
typename c,
typename t>
89 void save(std::basic_ostream<c,t>&
os,
const NT& v,
IT index)
95 template <
class HANDLER>
104 template <
typename _BinaryOperation>
112 template <
class HANDLER>
116 template <
class HANDLER>
121 template <
class ITRHS,
class NTRHS>
129#pragma omp parallel for
131 for(
IT i=0; i < arr.size(); ++i)
152 template <
class NT1,
typename _BinaryOperationIdx,
typename _BinaryOperationVal>
154 template <
class NT1,
typename _BinaryOperationIdx>
169 const std::vector<NT>&
GetLocVec()
const {
return arr; }
171 template <
typename _Predicate>
176 template <
typename _Predicate>
179 template <
typename _Predicate>
182 template <
typename _UnaryOperation>
185 std::transform(arr.begin(), arr.end(), arr.begin(),
__unary_op);
188 template <
typename _BinaryOperation>
193 #pragma omp parallel for
195 for(
size_t i=0; i < arr.size(); ++i)
199 template <
typename _UnaryOperation,
typename IRRELEVANT_NT>
203 template <
typename _BinaryOperation,
typename _BinaryPredicate,
class NT2>
205 template <
typename _BinaryOperation,
typename _BinaryPredicate,
class NT2>
209 template <
typename _BinaryOperation,
typename _BinaryPredicate,
class NT2>
217 template <
typename _BinaryOperation,
typename _BinaryPredicate,
class NT2>
227 template <
typename T1,
typename T2>
236 template <
typename _BinaryOperation,
class NT2>
241 template <
typename _BinaryOperation,
class NT2>
251 std::copy(arr.begin(), arr.end(), std::ostream_iterator<NT> (
output,
" "));
258 std::shared_ptr<CommGrid>
getcommgrid()
const {
return commGrid; }
263 template <
typename _BinaryOperation>
266 template <
typename OUT,
typename _BinaryOperation,
typename _UnaryOperation>
271 template <
typename _BinaryOperation,
typename OUT =
typename std::result_of<_BinaryOperation&(NT,NT)>::type>
278 std::vector< NT > arr;
280 template <
typename _BinaryOperation>
283 template <
class IU,
class NU>
286 template <
class IU,
class NU,
class UDER>
289 template <
class IU,
class NU>
292 template <
class IU,
class NU>
295 template <
class IU,
class NU>
298 template <
typename SR,
typename IU,
typename NUM,
typename NUV,
typename UDER>
302 template <
typename IU,
typename NU1,
typename NU2>
306 template <
typename IU,
typename NU1,
typename NU2,
typename _BinaryOperation>
310 template <
typename RET,
typename IU,
typename NU1,
typename NU2,
typename _BinaryOperation,
typename _BinaryPredicate>
314 template <
typename RET,
typename IU,
typename NU1,
typename NU2,
typename _BinaryOperation,
typename _BinaryPredicate>
318 template <
typename IU>
321 template <
typename IU,
typename NU>
324 template <
typename IU,
typename NU>
327 template <
class IU,
class DER>
void save(std::basic_ostream< c, t > &os, const NT &v, IT index)
NT read(std::basic_istream< c, t > &is, IT index)
bool operator()(const T1 &x, const T2 &y)
FullyDistVec< IT, IT > FindInds(_Predicate pred) const
Return the indices where pred is true.
friend FullyDistSpVec< IU, RET > EWiseApply_threaded(const FullyDistSpVec< IU, NU1 > &V, const FullyDistVec< IU, NU2 > &W, _BinaryOperation _binary_op, _BinaryPredicate _doOp, bool allowVNulls, NU1 Vzero, const bool useExtendedBinOp)
void ParallelRead(const std::string &filename, bool onebased, _BinaryOperation BinOp)
friend FullyDistVec< IU, typename promote_trait< NUM, NUV >::T_promote > SpMV(const SpParMat< IU, NUM, UDER > &A, const FullyDistVec< IU, NUV > &x)
void ParallelWrite(const std::string &filename, bool onebased, bool includeindices=true)
void EWiseApply(const FullyDistSpVec< IT, NT2 > &other, _BinaryOperation __binary_op, bool applyNulls, NT2 nullValue)
std::ifstream & ReadDistribute(std::ifstream &infile, int master, HANDLER handler)
NT Reduce(_BinaryOperation __binary_op, NT identity) const
friend FullyDistSpVec< IU, typename promote_trait< NU1, NU2 >::T_promote > EWiseApply(const FullyDistSpVec< IU, NU1 > &V, const FullyDistVec< IU, NU2 > &W, _BinaryOperation _binary_op, typename promote_trait< NU1, NU2 >::T_promote zero)
FullyDistVec< IT, NT > operator()(const FullyDistVec< IT, IT > &ri) const
void EWiseApply(const FullyDistSpVec< IT, NT2 > &other, _BinaryOperation __binary_op, _BinaryPredicate _do_op, bool applyNulls, NT2 nullValue)
void EWiseApply(const FullyDistVec< IT, NT2 > &other, _BinaryOperation __binary_op, _BinaryPredicate _do_op)
void ParallelWrite(const std::string &filename, bool onebased, HANDLER handler, bool includeindices=true)
FullyDistSpVec< IT, NT > Find(_Predicate pred) const
Return the elements for which pred is true.
bool operator==(const FullyDistVec< IT, NT > &rhs) const
void PrintInfo(std::string vectorname) const
void SaveGathered(std::ofstream &outfile, int master, HANDLER handler, bool printProcSplits=false)
void ApplyInd(_BinaryOperation __binary_op)
FullyDistVec< IT, NT > & operator-=(const FullyDistSpVec< IT, NT > &rhs)
friend SpParMat< IU, bool, DER > PermMat(const FullyDistVec< IU, IU > &ri, const IU ncol)
void SetElement(IT indx, NT numx)
void iota(IT globalsize, NT first)
std::shared_ptr< CommGrid > getcommgrid() const
friend void RenameVertices(DistEdgeList< IU > &DEL)
NT operator[](IT indx) const
void Set(const FullyDistSpVec< IT, NT > &rhs)
friend class FullyDistVec
FullyDistSpVec< IT, NT > GGet(const FullyDistSpVec< IT, NT1 > &spVec, _BinaryOperationIdx __binopIdx, NT nullValue)
IT Count(_Predicate pred) const
Return the number of elements for which pred is true.
FullyDistVec< IT, NT > & operator+=(const FullyDistSpVec< IT, NT > &rhs)
FullyDistVec< IT, NT > & operator=(NT fixedval)
friend FullyDistSpVec< IU, typename promote_trait< NU1, NU2 >::T_promote > EWiseMult(const FullyDistSpVec< IU, NU1 > &V, const FullyDistVec< IU, NU2 > &W, bool exclude, NU2 zero)
void SelectCandidates(double nver)
ABAB: Put concept check, NT should be integer for this to make sense.
const std::vector< NT > & GetLocVec() const
friend void Augment(FullyDistVec< int64_t, int64_t > &mateRow2Col, FullyDistVec< int64_t, int64_t > &mateCol2Row, FullyDistVec< int64_t, int64_t > &parentsRow, FullyDistVec< int64_t, int64_t > &leaves)
void Apply(_UnaryOperation __unary_op)
void EWiseOut(const FullyDistVec< IT, NT > &rhs, _BinaryOperation __binary_op, FullyDistVec< IT, OUT > &result)
void EWiseApply(const FullyDistVec< IT, NT2 > &other, _BinaryOperation __binary_op)
friend void maximumMatching(SpParMat< int64_t, bool, SpDCCols< int64_t, bool > > &A, FullyDistVec< int64_t, int64_t > &mateRow2Col, FullyDistVec< int64_t, int64_t > &mateCol2Row)
void PrintToFile(std::string prefix)
void SaveGathered(std::ofstream &outfile, int master)
void SetLocalElement(IT index, NT value)
const NT * GetLocArr() const
void GSet(const FullyDistSpVec< IT, NT1 > &spVec, _BinaryOperationIdx __binopIdx, _BinaryOperationVal __binopVal, MPI_Win win)
std::ifstream & ReadDistribute(std::ifstream &infile, int master)
NT GetElement(IT indx) const
friend FullyDistVec< IU, NU > Concatenate(std::vector< FullyDistVec< IU, NU > > &vecs)
FullyDistVec< IT, NT > & operator=(const FullyDistVec< ITRHS, NTRHS > &rhs)
std::pair< IT, NT > MinElement() const
FullyDistVec< IT, IT > sort()