45template <
class IU,
class NU>
48template <
class IU,
class NU>
51template <
class IU,
class NU>
54template <
class IU,
class NU>
64template <
class IT,
class NT>
65class SpTuples:
public SpMat<IT, NT, SpTuples<IT,NT> >
70 SpTuples (
int64_t size,
IT nRow,
IT nCol, std::tuple<IT, IT, NT> * mytuples,
bool sorted =
false,
bool isOpNew =
false);
71 SpTuples (
int64_t maxnnz,
IT nRow,
IT nCol, std::vector<IT> & edges,
bool removeloops =
true);
73 SpTuples (
const SpTuples<IT,NT> & rhs);
74 SpTuples (
const SpDCCols<IT,NT> & rhs);
75 SpTuples (
const SpCCols<IT,NT> & rhs);
78 SpTuples<IT,NT> &
operator=(
const SpTuples<IT,NT> & rhs);
89 template <
typename BINFUNC>
115 std::vector<bool>
existing(n,
false);
117 for(
IT i=0; i< nnz; ++i)
119 if(joker::get<0>(
tuples[i]) == joker::get<1>(
tuples[i]))
128 for(
IT i = 0; i < n; ++i)
133 std::tuple<IT, IT, NT> *
ntuples =
new std::tuple<IT,IT,NT>[nnz+
toadd];
145 ::operator
delete(
tuples);
149 isOperatorNew =
false;
164 std::vector<bool>
existing(n,
false);
166 for(
IT i=0; i< nnz; ++i)
168 if(joker::get<0>(
tuples[i]) == joker::get<1>(
tuples[i]))
177 for(
IT i = 0; i < n; ++i)
182 std::tuple<IT, IT, NT> *
ntuples =
new std::tuple<IT,IT,NT>[nnz+
toadd];
191 ::operator
delete(
tuples);
195 isOperatorNew =
false;
206 for(
IT i=0; i< nnz; ++i)
210 std::tuple<IT, IT, NT> *
ntuples =
new std::tuple<IT,IT,NT>[nnz-
loop];
213 for(
IT i=0; i< nnz; ++i)
215 if(joker::get<0>(
tuples[i]) != joker::get<1>(
tuples[i]))
221 ::operator
delete(
tuples);
225 isOperatorNew =
false;
237 return std::make_pair(joker::get<0>(*
minit), joker::get<0>(*
maxit));
240 return std::make_pair(0,0);
249 return std::make_pair(joker::get<1>(*
minit), joker::get<1>(*
maxit));
252 return std::make_pair(0,0);
258 template<
typename SR,
typename IU,
typename NU>
261 template<
typename SR,
typename IU,
typename NU>
272 bool isZero()
const {
return (nnz == 0); }
292 template <
class IU,
class NU>
295 template <
class IU,
class NU>
static bool is_sorted(_ForwardIterator __first, _ForwardIterator __last)
std::ifstream & get(std::ifstream &infile)
std::ofstream & put(std::ofstream &outfile) const
std::tuple< IT, IT, NT > * tuples
SpTuples< IT, NT > & operator=(const SpTuples< IT, NT > &rhs)
SpTuples(int64_t size, IT nRow, IT nCol)
IT AddLoops(NT loopval, bool replaceExisting=false)
friend SpTuples< IU, NU > MergeAll(const std::vector< SpTuples< IU, NU > * > &ArrSpTups, IU mstar, IU nstar, bool delarrs)
std::ofstream & putstream(std::ofstream &outfile) const
std::ifstream & getstream(std::ifstream &infile)
IT AddLoops(std::vector< NT > loopvals, bool replaceExisting=false)
void RemoveDuplicates(BINFUNC BinOp)
std::tuple< IT, IT, NT > back()
std::pair< IT, IT > ColLimits()
friend SpTuples< IU, NU > * MergeAllRec(const std::vector< SpTuples< IU, NU > * > &ArrSpTups, IU mstar, IU nstar)
std::tuple< IT, IT, NT > front()
std::pair< IT, IT > RowLimits()