dimforge / dimforge/nalgebra

MulAssign on MatrixViewMut does not work.

Open
#1,531 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

I'm trying to run the following:

```rust
use std::ops::MulAssign;

use nalgebra::Const;
use nalgebra::DMatrix;
use nalgebra::Matrix;

fn main() {
let identity = nalgebra::Matrix4::::identity();

let mut matrix = Matrix::, Const<4>, _>::zeros();
let mut view = matrix.view_mut((0, 0), (5, 4));
view.mul_assign(identity); // <-- doesn't work

let mut points = DMatrix::zeros(8, 5);
let mut view = points.view_mut((0, 0), (5, 4));
view.mul_assign(identity); // <-- works
}
```

But the first example doesn't work and gives the following error:

```rust
error[E0308]: mismatched types
--> src/main.rs:12:21
|
12 | view.mul_assign(identity); // <-- doesn't work
| ---------- ^^^^^^^^ expected `f32`, found `Matrix, Const<4>, ArrayStorage>`
| |
| arguments to this method are incorrect
|
= note: expected type `f32`
found struct `Matrix, Const<4>, ArrayStorage>`
note: method defined here
--> /home/hgaiser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:877:8
|
877 | fn mul_assign(&mut self, rhs: Rhs);
| ^^^^^^^^^^
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.