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

Add checks for matching shapes in Solve, SolveH, and EighInplace #290

Merged
merged 6 commits into from
Jun 12, 2021

Conversation

jturner314
Copy link
Member

Whenever two arrays are used in a single operation, we need to check that the shapes are compatible. Without these checks, we get segfaults, etc.

@jturner314 jturner314 added the bug Bug issue, or bug fix change label May 20, 2021
@codecov
Copy link

codecov bot commented May 20, 2021

Codecov Report

Merging #290 (d7e5672) into master (6de9acc) will increase coverage by 0.08%.
The diff coverage is 94.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #290      +/-   ##
==========================================
+ Coverage   89.01%   89.09%   +0.08%     
==========================================
  Files          71       71              
  Lines        3578     3633      +55     
==========================================
+ Hits         3185     3237      +52     
- Misses        393      396       +3     
Impacted Files Coverage Δ
ndarray-linalg/src/solve.rs 72.18% <66.66%> (-0.41%) ⬇️
ndarray-linalg/src/eigh.rs 92.30% <100.00%> (+0.47%) ⬆️
ndarray-linalg/src/solveh.rs 74.50% <100.00%> (+0.77%) ⬆️
ndarray-linalg/tests/eigh.rs 100.00% <100.00%> (ø)
ndarray-linalg/tests/solve.rs 100.00% <100.00%> (ø)
ndarray-linalg/tests/solveh.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6de9acc...d7e5672. Read the comment docs.

@jturner314 jturner314 force-pushed the check-compatible-shapes branch from 389fd77 to d7e5672 Compare May 27, 2021 22:12
@jturner314
Copy link
Member Author

The primary question is whether to panic or return an error in the case of mismatching shapes. @bluss or @termoshtt do you have an opinion on this?

@bluss
Copy link
Member

bluss commented May 28, 2021

(I'm not a maintainer of this crate) I don't know the error handling story in this crate so well, but panic on shape mismatch fits my general definition quite well. It's not a very "dynamic" condition: the program should be constructed so that it's known the two inputs have compatible shapes at that point in the program, otherwise there was a bug.

@termoshtt
Copy link
Member

but panic on shape mismatch fits my general definition quite well. It's not a very "dynamic" condition

This should be correct.

@termoshtt termoshtt merged commit 3bf9387 into rust-ndarray:master Jun 12, 2021
termoshtt added a commit that referenced this pull request Jun 12, 2021
@jturner314 jturner314 deleted the check-compatible-shapes branch June 13, 2021 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug issue, or bug fix change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants