Open MelvinSam2000 opened 1 year ago
Static matrices should support determinants:
i.e. this code works:
use nalgebra; // 0.32.3
fn main() {
let m = nalgebra::base::Matrix::<f32, nalgebra::base::Const<4>, nalgebra::base::Const<4>, _>::new(1., 1., 1., 1.,
1., 1., 1., 1.,
1., 1., 1., 1.,
1., 1., 1., 1.,);
let det = m.determinant();
}
Can you provide the source of your code to help understand why it's not working?
Hi, here is the sample code which does not compile:
fn demonstration<const N: usize>(mat: SMatrix<f64, N, N>) -> f64 { mat.determinant() }
This does not compile and gives the error I posted. After asking in the discord server I got a quick solution as such:
fn demonstration<const N: usize>(mat: &SMatrix<f64, N, N>) -> f64 { mat.view((0, 0), (N, N)).determinant() }
This works so it was enough for me, but not sure if its ideal. Letting you know just in case.
I am unable to compute the determinant of an SMatrix (even if the dimensions are equal). Here is the error I get:
determinant
exists for reference&Matrix<f64, Const<N>, Const<N>, ArrayStorage<f64, N, N>>
, but its trait bounds were not satisfied --> src/gmm.rs:73:25&Matrix<f64, Const<N>, Const<N>, ArrayStorage<f64, N, N>>
due to unsatisfied trait bounds<Const<N> as DimMin<Const<N>>>::Output = Const<N>
Const<N>: DimMin<Const<N>>
Is there something Im missing or is it just not ready for SMatrices yet?