nalgebra icon indicating copy to clipboard operation
nalgebra copied to clipboard

Confusing documentation on `strides`

Open johnmave126 opened this issue 2 years ago • 2 comments

According to RawStorage::strides

The spacing between consecutive row elements and consecutive column elements.

For example this returns (1, 5) for a row-major matrix with 5 columns.

But according to the implementation of RawStorage::linear_index: https://github.com/dimforge/nalgebra/blob/52e6db99c6e3615512801d5f43d9f9c8399627d8/src/base/storage.rs#L70-L75

(1, 5) is a column-major matrix with 5 rows, as elements in the same column are consecutive in memory.

My personal suggested wording would be "The spacing between consecutive elements across rows and across columns.", but let's discuss. Or we could adapt the wording from NumPy.

johnmave126 avatar Mar 07 '23 18:03 johnmave126

I like the wording you suggest. And, yes, the documentation is misleading here since nalgebra does not have row-major matrices anyway.

sebcrozet avatar Apr 07 '23 14:04 sebcrozet

Hey! If this is still available, I'd love to contribute with a PR :)

RaulWCosta avatar Aug 05 '23 16:08 RaulWCosta