mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fixed indexing mistake in cuistl/vector_operations
This commit is contained in:
parent
046ef6cdc0
commit
133a8897a0
@ -54,7 +54,7 @@ namespace
|
||||
// TODO: [perf] Is it faster to just use a mask? Probably does not matter either way
|
||||
// This is hopefully not where we will spend most of our time.
|
||||
if (globalIndex < numberOfElements) {
|
||||
buffer[indices[globalIndex]] = a[indices[globalIndex]] * b[indices[globalIndex]];
|
||||
buffer[globalIndex] = a[indices[globalIndex]] * b[indices[globalIndex]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,5 +280,16 @@ BOOST_AUTO_TEST_CASE(RandomVectors)
|
||||
BOOST_CHECK_EQUAL(projectedA[i], a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
aGPU = GVector(a);
|
||||
auto twoNormAtIndices = aGPU.two_norm(indexSetGPU);
|
||||
|
||||
double correctTwoNormAtIndices = 0.0;
|
||||
for (size_t i = 0; i < indexSet.size(); ++i) {
|
||||
correctTwoNormAtIndices += a[indexSet[i]] * a[indexSet[i]];
|
||||
}
|
||||
correctTwoNormAtIndices = std::sqrt(correctTwoNormAtIndices);
|
||||
|
||||
BOOST_CHECK_CLOSE(correctTwoNormAtIndices, twoNormAtIndices, 1e-7);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user