64 bool strideOne =
false;
66 if (valueStrides == NULL) strideOne =
true;
68 if (ia->getNumEntriesPerID() != mvdim)
71 if (!
fail && ia->getNumWeightsPerID() != wdim)
74 if (!
fail && ia->getLocalNumIDs() !=
size_t(len))
78 ia->getIDsView(idList);
79 for (
int i=0; !
fail && i < len; i++)
80 if (!
fail && idList[i] != ids[i])
83 for (
int v=0; !
fail && v < mvdim; v++){
85 int correctStride = (strideOne ? 1 : valueStrides[v]);
88 ia->getEntriesView(vals, stride, v);
90 if (!
fail && stride != correctStride)
93 for (
int i=0; !
fail && i < len; i++){
100 for (
int w=0; !
fail && w < wdim; w++){
104 ia->getWeightsView(wgts, stride, w);
106 if (!
fail && stride != weightStrides[w])
109 for (
int i=0; !
fail && i < len; i++){
110 if (wgts[stride*i] !=
weights[w][weightStrides[w]*i])
121 Tpetra::ScopeGuard tscope(&narg, &arg);
122 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
124 int rank = comm->getRank();
125 int nprocs = comm->getSize();
133 zgno_t myFirstId = rank * numLocalIds;
137 int *weightStrides =
new int [wdim];
143 int *valueStrides =
new int [mvdim];
146 for (
zlno_t i=0; i < numLocalIds; i++){
147 myIds[i] = myFirstId+i;
149 for (
int w=0; w < wdim; w++)
150 weights[w*numLocalIds + i] = w + 1 + nprocs - rank;
152 v_values[i] = numLocalIds-i;
154 for (
int v=0; v < mvdim; v++)
155 mv_values[i*mvdim + v] = (v+1) * (nprocs-rank) / (i+1);
158 for (
int w=0; w < wdim; w++){
159 weightStrides[w] = 1;
160 weightPtrs[w] =
weights + numLocalIds*w;
163 for (
int v=0; v < mvdim; v++){
164 valueStrides[v] = mvdim;
165 valuePtrs[v] = mv_values + v;
173 std::vector<const zscalar_t *> weightValues;
174 std::vector<int> strides;
180 catch (std::exception &e){
187 myIds, 1, valuePtrs, NULL, 0, NULL, NULL);
197 std::vector<const zscalar_t *> weightValues;
198 std::vector<int> strides;
200 weightValues.push_back(weightPtrs[0]);
201 weightValues.push_back(weightPtrs[1]);
202 strides.push_back(1);
203 strides.push_back(1);
207 v_values, 1,
true, weightPtrs[0], 1);
209 catch (std::exception &e){
216 myIds, 1, valuePtrs, NULL, 1, weightPtrs, weightStrides);
226 std::vector<const zscalar_t *> weightValues, values;
227 std::vector<int> wstrides, vstrides;
229 for (
int dim=0; dim < mvdim; dim++){
230 values.push_back(valuePtrs[dim]);
231 vstrides.push_back(mvdim);
237 numLocalIds, myIds, values, vstrides, weightValues, wstrides);
239 catch (std::exception &e){
246 myIds, mvdim, valuePtrs, valueStrides, 0, NULL, NULL);
256 std::vector<const zscalar_t *> weightValues, values;
257 std::vector<int> wstrides, vstrides;
259 for (
int dim=0; dim < wdim; dim++){
260 weightValues.push_back(weightPtrs[dim]);
261 wstrides.push_back(1);
264 for (
int dim=0; dim < mvdim; dim++){
265 values.push_back(valuePtrs[dim]);
266 vstrides.push_back(mvdim);
271 numLocalIds, myIds, values, vstrides, weightValues, wstrides);
274 catch (std::exception &e){
281 myIds, mvdim, valuePtrs, valueStrides,
282 wdim, weightPtrs, weightStrides);
290 std::cout <<
"PASS" << std::endl;
294 delete [] weightStrides;
295 delete [] weightPtrs;
298 delete [] valueStrides;