Linear algebra library for Rust.
Go to file
Jenan Wise 85a64fb517 More verbose DMatrix dim asserts where possible.
Previously, most dimension mismatch asserts used raw `assert!` and did
not include the mismatching dimensions in the panic message. When using
dynamic matrices, this led to somewhat-opaque panics such as:

```rust
let m1 = DMatrix::<f32>::zeros(2, 3);
let m2 = DMatrix::<f32>::zeros(5, 10);
m1 + m2 // panic: Matrix addition/subtraction dimensions mismatch.
```

This patch adds dimension information in the panic messages wherever
doing so did not add additional bounds checks, mostly by simply changing
`assert!(a == b, ...)` cases to `assert_eq!`. After:

```rust
// panic: assertion failed: `(left == right)`
//   left: `(2, 3)`,
//  right: `(5, 10)`: Matrix addition/subtraction dimensions mismatch.
```

Note that the `gemv` and `ger` were not updated, as they are called from
within other functions on subset matricies -- e.g., `gemv` is called
from `gemm` which is called from `mul_to` . Including dimension
information in the `gemv` panic messages would be confusing to
`mul` / `mul_to` users, because it would include dimensions of the column
vectors that `gemm` passes to `gemv` rather than of the original `mul`
arguments. A fix would be to add bounds checks to `mul_to`, but that may
have performance and redundancy implications, so is left to another
patch.
2020-06-22 17:18:53 -07:00
.circleci CI: don't run nalgebra-lapack test for now. 2020-04-05 21:00:42 +02:00
.github Create FUNDING.yml 2019-10-28 14:15:03 +01:00
benches Run cargo fmt. 2020-04-05 18:49:48 +02:00
ci ci: link to system BLAS as intended 2020-03-02 12:45:38 +01:00
examples Release nalgebra v0.21.0 2020-04-05 23:19:10 +02:00
nalgebra-glm Use the #[rustfmt::skip] attribute instead of rustfmt_skip. 2020-06-07 09:30:21 +02:00
nalgebra-lapack Release nalgebra v0.21.0 2020-04-05 23:19:10 +02:00
src More verbose DMatrix dim asserts where possible. 2020-06-22 17:18:53 -07:00
tests Use the #[rustfmt::skip] attribute instead of rustfmt_skip. 2020-06-07 09:30:21 +02:00
.gitignore Add .idea folder to gitignore. 2018-09-13 09:23:08 +02:00
.travis.yml Fix CI (#634) 2019-08-27 22:05:28 +02:00
Cargo.toml Release v0.21.1 2020-06-07 10:29:10 +02:00
CHANGELOG.md Release v0.21.1 2020-06-07 10:29:10 +02:00
LICENSE Initial commit. 2013-05-14 11:34:28 +00:00
Makefile Add matrix slice construction from array slices. 2018-02-03 13:59:05 +01:00
README.md HTTPS All The Things (#608) 2019-08-27 22:05:28 +02:00
rustfmt.toml Add rustfmt.toml. 2018-11-06 18:32:31 +01:00

crates.io

Build status crates.io

Users guide | Documentation | Forum


Linear algebra library for the Rust programming language.


 Click this button if you wish to donate to support the development of nalgebra:

Become a Patron!