30 #ifndef _PRE_ALLOCATED_SPA_H 31 #define _PRE_ALLOCATED_SPA_H 51 if( A.getnsplit() > 0)
53 int64_t perpiece = mA / A.getnsplit();
54 for(
int i=0; i<A.getnsplit(); ++i)
56 if(i != A.getnsplit()-1)
59 V_localy.push_back(std::vector<OVT>(perpiece));
61 std::vector<bool> isthere(perpiece,
false);
62 for(
auto colit = A.begcol(i); colit != A.endcol(i); ++colit)
64 for(
auto nzit = A.begnz(colit,i); nzit != A.endnz(colit,i); ++nzit)
66 size_t rowid = nzit.rowid();
67 if(!isthere[rowid]) isthere[rowid] =
true;
70 size_t maxvector = std::count(isthere.begin(), isthere.end(),
true);
71 V_inds.push_back(std::vector<uint32_t>(maxvector));
76 V_localy.push_back(std::vector<OVT>(mA - i*perpiece));
78 std::vector<bool> isthere(mA - i*perpiece,
false);
79 for(
auto colit = A.begcol(i); colit != A.endcol(i); ++colit)
81 for(
auto nzit = A.begnz(colit,i); nzit != A.endnz(colit,i); ++nzit)
83 size_t rowid = nzit.rowid();
84 if(!isthere[rowid]) isthere[rowid] =
true;
87 size_t maxvector = std::count(isthere.begin(), isthere.end(),
true);
88 V_inds.push_back(std::vector<uint32_t>(maxvector));
95 V_localy.push_back(std::vector<OVT>(mA));
97 std::vector<bool> isthere(mA,
false);
98 for(
auto colit = A.begcol(); colit != A.endcol(); ++colit)
100 for(
auto nzit = A.begnz(colit); nzit != A.endnz(colit); ++nzit)
102 size_t rowid = nzit.rowid();
103 if(!isthere[rowid]) isthere[rowid] =
true;
106 size_t maxvector = std::count(isthere.begin(), isthere.end(),
true);
107 V_inds.push_back(std::vector<uint32_t>(maxvector));
114 template <
class LMAT>
120 V_localy.push_back(std::vector<OVT>(mA));
121 V_inds.push_back(std::vector<uint32_t>(mA));
127 std::vector<int32_t> nnzSplitA(
buckets,0);
128 int32_t rowPerSplit = mA / splits;
132 for(
int i=0; i<splits-1; i++)
134 V_isthereBool.push_back(std::vector<bool>(mA - (splits-1)*rowPerSplit));
138 for(
auto colit = A.begcol(); colit != A.endcol(); ++colit)
140 for(
auto nzit = A.begnz(colit); nzit != A.endnz(colit); ++nzit)
142 size_t rowid = nzit.rowid();
144 size_t splitId = (rowid/rowPerSplit > splits-1) ? splits-1 : rowid/rowPerSplit;
145 nnzSplitA[splitId]++;
151 disp.resize(splits+1);
153 for(
int i=0; i<splits; i++)
165 template <
class LMAT>
174 V_localy.push_back(std::vector<OVT>(mA));
175 V_inds.push_back(std::vector<uint32_t>(mA));
177 std::vector<int32_t> nnzSplitA(
buckets,0);
178 int32_t rowPerSplit = mA / splits;
180 for(
int i=0; i<splits-1; i++)
182 V_isthereBool.push_back(std::vector<bool>(mA - (splits-1)*rowPerSplit));
185 for(
auto colit = A.begcol(); colit != A.endcol(); ++colit)
187 for(
auto nzit = A.begnz(colit); nzit != A.endnz(colit); ++nzit)
189 size_t rowid = nzit.rowid();
191 size_t splitId = (rowid/rowPerSplit > splits-1) ? splits-1 : rowid/rowPerSplit;
192 nnzSplitA[splitId]++;
198 disp.resize(splits+1);
200 for(
int i=0; i<splits; i++)
211 std::vector< std::vector<uint32_t> >
V_inds;
std::vector< std::vector< bool > > V_isthereBool
std::vector< BitMap > V_isthere
std::vector< int32_t > indSplitA
std::vector< std::vector< OVT > > V_localy
std::vector< std::vector< uint32_t > > V_inds
void Init(LMAT &A, int splits)
std::vector< uint32_t > disp
std::vector< OVT > numSplitA
PreAllocatedSPA(LMAT &A, int splits)