Convolution with SVector
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to use the `convolve` methods with `SVector`'s, but it doesn't seem to work. Here is an example:
```
use nalgebra::{DVector, SVector};
mod image;
fn main() {
let vec = vec![1.0,2.0,3.0,4.0];
let kernel = vec![1.0,2.0];
let vec_d = DVector::from_vec(vec.clone());
let ker_d = DVector::from_vec(kernel.clone());
let expected_d_full = vec_d.convolve_full(ker_d.clone());
let expected_d_valid = vec_d.convolve_valid(ker_d.clone());
let expected_d_same = vec_d.convolve_same(ker_d);
println!("full d: {:?}",expected_d_full);
println!("valid d: {:?}",expected_d_valid);
println!("same d: {:?}",expected_d_same);
let vec_s = SVector::from_vec(vec);
let ker_s = SVector::from_vec(kernel);
let expected_s_full = vec_s.convolve_full(ker_s.clone());
let expected_s_valid = vec_s.convolve_valid(ker_s.clone());
let expected_s_same = vec_s.convolve_same(ker_s);
println!("full s: {:?}",expected_s_full);
println!("valid s: {:?}",expected_s_valid);
println!("same s: {:?}",expected_s_same);
}
```
This produces the following error:
```
error[E0599]: no method named `convolve_full` found for struct `Matrix<{float}, nalgebra::Const<_>, nalgebra::Const<1>, ArrayStorage<{float}, _, 1>>` in the current scope
--> src/main.rs:33:33
|
33 | let expected_s_full = vec_s.convolve_full(ker_s.clone());
| ^^^^^^^^^^^^^ method not found in `Matrix<{float}, Const<_>, Const<1>, ArrayStorage<{float}, _, 1>>`
|
= note: the method was found for
- `Matrix, S1>`
```
Is there any way to make these methods abstract of the type of Vector? Or does there need to be a second set of methods for the `SVector` type?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.