stack! macro cannot deal with matrix size in some situation
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
`stack!` macro sometimes fails to create block matrices in the situation where
1. one of the input matrices is statically sized with generics
2. horizontal stack + row size bound with generics
```rust
use nalgebra::{stack, Const, DMatrix, DVector, Dyn, OMatrix, SMatrix, SVector};
fn calc() -> OMatrix, Dyn> {
let mat_a: SMatrix = SMatrix::from_element(1.0);
let mat_b: SVector = SVector::from_element(1.0);
let ret = stack![mat_a, mat_b];
ret
}
fn calc_dyn1() -> OMatrix, Dyn> {
let mat_a: SMatrix = SMatrix::from_element(1.0);
let mat_b: DVector = DVector::from_element(D, 1.0);
let ret = stack![mat_a, mat_b];
ret
}
fn calc_dyn2() -> OMatrix, Dyn> {
let mat_a: SMatrix = SMatrix::from_element(1.0);
let mat_b: DVector = DVector::from_element(D, 1.0);
let ret = stack![mat_b, mat_a];
ret
}
fn calc_dyn3() -> OMatrix, Dyn> {
let mat_a = DMatrix::from_element(D, D, 1.0);
let mat_b: SVector = SVector::from_element(1.0);
let ret = stack![mat_a, mat_b];
ret
}
fn main() {
println!("Hello, world!");
println!("{}", calc::<3>()); // invalid
println!("{}", calc_dyn1::<3>()); // invalid
println!("{}", calc_dyn2::<3>()); // invalid
println!("{}", calc_dyn3::<3>()); // valid
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.