Closed pavel-po closed 1 month ago
Thank you @pavel-po for opening this issue!
I think the problem is already the reshaping of the array, i.e.
auto v_3d_noncont_1d = nda::reshaped_view(v_3d_noncont, std::array<long,1>{n*n*n});
should not be allowed since v_3d_noncont
is not contiguous in memory.
If you compile the code in debug mode, i.e. with -DCMAKE_BUILD_TYPE=Debug
, then you should in fact get an error that the reshaping fails (see nda/layout_transforms.hpp).
Yes, as detailed also in the nda::reshape documentation the input needs to be contiguous. The runtime checks are currently enabled only in debug mode as @Thoemi09 pointed out. Closing this.
Description
nda::blas::dot gives incorrect results when nda arrays are non-contiguous in memory.
Steps to Reproduce
A patch to the existing linear algebra test demonstrates the issue by comparison of the dot products of non-contiguous arrays with dot products of contiguous array copies.
Versions
The issue is reproduced on Rusty with the following NDA version used in BeyondDFT: