MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / mv

Function mv

src/backend/opencl/cpu/cpu_sparse_blas.cpp:294–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292
293template<typename T, bool conjugate>
294void mv(Array<T> output, const Array<T> values, const Array<int> rowIdx,
295 const Array<int> colIdx, const Array<T> right, int M) {
296 UNUSED(M);
297 mapped_ptr<T> oPtr = output.getMappedPtr();
298 mapped_ptr<T> rhtPtr = right.getMappedPtr();
299 mapped_ptr<T> vPtr = values.getMappedPtr();
300 mapped_ptr<int> rPtr = rowIdx.getMappedPtr();
301 mapped_ptr<int> cPtr = colIdx.getMappedPtr();
302
303 T const *const valPtr = vPtr.get();
304 int const *const rowPtr = rPtr.get();
305 int const *const colPtr = cPtr.get();
306 T const *const rhsPtr = rhtPtr.get();
307 T *const outPtr = oPtr.get();
308
309 for (int i = 0; i < rowIdx.dims()[0] - 1; ++i) {
310 outPtr[i] = scalar<T>(0);
311 for (int j = rowPtr[i]; j < rowPtr[i + 1]; ++j) {
312 // If stride[0] of right is not 1 then rhsPtr[colPtr[j]*stride]
313 if (conjugate) {
314 outPtr[i] =
315 outPtr[i] + getConjugate(valPtr[j]) * rhsPtr[colPtr[j]];
316 } else {
317 outPtr[i] = outPtr[i] + valPtr[j] * rhsPtr[colPtr[j]];
318 }
319 }
320 }
321}
322
323template<typename T, bool conjugate>
324void mtv(Array<T> output, const Array<T> values, const Array<int> rowIdx,

Callers

nothing calls this directly

Calls 4

getConjugateFunction · 0.70
getMappedPtrMethod · 0.45
getMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected