Skip to content

Fix/matrix multiplication row major - #1613

Open
McModknower wants to merge 3 commits into
dimforge:mainfrom
McModknower:fix/matrix-multiplication-row-major
Open

Fix/matrix multiplication row major#1613
McModknower wants to merge 3 commits into
dimforge:mainfrom
McModknower:fix/matrix-multiplication-row-major

Conversation

@McModknower

Copy link
Copy Markdown

Due to base::blas_uninit::axcpy_uninit not taking the stride into account for calculating the number of elements at

array_axc(status, y, a, x, c, rstride1, rstride2, x.len());
, multiplying matricies with a row stride other than 1 fails with the following error message:

thread 'core::blas::array_axcpy_nonstandard_stride' (21450) panicked at /home/teddy/uni-notes/ma/rumspielen/nalgebra/src/base/blas_uninit.rs:71:19:
unsafe precondition(s) violated: slice::get_unchecked_mut requires that the index is within the slice

This indicates a bug in the program. This Undefined Behavior check is optional, and cannot be relied on for safety.

This pull request introduces a test for this case and fixes the bug by properly calculating the number of elements via a tested helper function number_of_elements(len: usize, stride: usize) -> usize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant