Cant use SVD on a matrix larger than U127 by U127

54 Views Asked by At

The following code fails to compile

extern crate nalgebra as na;
use nalgebra_lapack::SVD;
use na::*;

fn main() {
    type Matrix128x128= SMatrix<f32, 128, 128>;

    let my_matrix: Matrix128x128 = Matrix128x128::repeat(0.0);

    let svd = SVD::new(my_matrix).unwrap();

    println!("vt:{}\nsv:{}\nu:{}", svd.vt, svd.singular_values, svd.u);
}

the error given by the compiler is as follows

error[E0277]: the trait bound `Const<128>: ToTypenum` is not satisfied
  --> src/main.rs:10:15
   |
10 |     let svd = SVD::new(my_matrix).unwrap();
   |               ^^^^^^^^ the trait `ToTypenum` is not implemented for `Const<128>`
   |
   = help: the following other types implement trait `ToTypenum`:
             Const<0>
             Const<1>
             Const<2>
             Const<3>
             Const<4>
             Const<5>
             Const<6>
             Const<7>
           and 120 others
   = note: required for `Const<128>` to implement `DimMin<Const<128>>`

However if instead of type Matrix128x128= SMatrix<f32, 128, 128>; i used type Matrix128x128= SMatrix<f32, 127, 127>; the code would compile and work.

Is there a way to compute the SVD of a matrix larger than 127?

0

There are 0 best solutions below