statrs-dev / statrs

Statistical computation library for Rust

Home Page:https://docs.rs/statrs/latest/statrs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[request] Update nalgebra dependency

saona-raimundo opened this issue · comments

I was using the MultivariateNormal.
Specifically, the continuous trait.

In my case, I had the data in ndarray, so I passed it to nalgebra.
But the nalgebra has a new version of 1d arrays.

For reference, this is the extract from rustc

                              gaussians[i].pdf(&nalgebra::base::DVector::from(point.to_vec())))
    |                                                --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&Matrix<f64, Dynamic, ..., ...>`, found `&Matrix<f64, Dyn, Const<1>, ...>`
    |                                                |
    |                                                arguments to this method are incorrect
    |
    = note: `Matrix<f64, Dyn, Const<1>, ...>` and `Matrix<f64, Dynamic, Const<1>, ...>` have similar names, but are actually distinct types
note: `Matrix<f64, Dyn, Const<1>, ...>` is defined in crate `nalgebra`
   --> ...\nalgebra-0.32.3\src\base\matrix.rs:175:1
    |
175 | pub struct Matrix<T, R, C, S> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `Matrix<f64, Dynamic, Const<1>, ...>` is defined in crate `nalgebra`
   --> ...\nalgebra-0.29.0\src\base\matrix.rs:157:1
    |
157 | pub struct Matrix<T, R, C, S> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `nalgebra` are being used?

As a second thought, would it not be better to impl<'a> Continuous<&'a [f64]> for MultivariateNormal?

I'm running into friction due to the older nalgebra version as well. Just curious what the best way to get traction on this is? It looks like there's already PR #187 and multiple other PRs to upgrade the version.

The implementation of impl Continuous<Vec<f64>> for MultivariateNormal solves the issue.