Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

into_nalgebra failed to work for 2d array with one row #13

Closed
qqlearn123 opened this issue May 13, 2023 · 1 comment
Closed

into_nalgebra failed to work for 2d array with one row #13

qqlearn123 opened this issue May 13, 2023 · 1 comment

Comments

@qqlearn123
Copy link

The following code section will panic:

let a = array!([[1.2, 2.3, 5.5]]);
let a2 = a.into_nalgebra();
@vadixidav
Copy link
Member

@qqlearn123 I tried this with my latest changes in #17 and this seems to work, but you may have an issue with your array or may have indexed starting at 1 instead of 0. Notably, ndarray::array should be used like array![[1.2, 2.3, 5.5]], and not like array!([[1.2, 2.3, 5.5]]). If you use it with parentheses, it will create three axes (the parentheses are treated like square brackets, and it is confusing). Just in case I added a test in #17 (see here) that specifically tests the case of a one row array just to make sure it works.

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

No branches or pull requests

2 participants