You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code for generating large random complex matrices doesn't seem to work.
extern crate rand;
extern crate typenum;
extern crate nalgebra;
use num::complex::Complex64;
use rand::prelude::*;
fn main() {
let mut r = rand::thread_rng();
let c = nalgebra::MatrixMN::<Complex64,typenum::U6,typenum::U1024>::from_fn(
|_,_| Complex64 { re: r.gen(), im: r.gen() }
);
println!("Matrix {}", c);
}
The compiler output is:
error[E0599]: no function or associated item named from_fn found for type nalgebra::Matrix<num::Complex<f64>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>, typenum::B0>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, nalgebra::ArrayStorage<num::Complex<f64>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>, typenum::B0>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>>> in the current scope
--> src/main.rs:11:73
|
11 | let c = nalgebra::MatrixMN::<Complex64,typenum::U6,typenum::U1024>::from_fn(
| ------------------------------------------------------------^^^^^^^
| |
| function or associated item not found in nalgebra::Matrix<num::Complex<f64>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>, typenum::B0>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, nalgebra::ArrayStorage<num::Complex<f64>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>, typenum::B0>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>>>
|
= note: the method from_fn exists but the following trait bounds were not satisfied: nalgebra::DefaultAllocator : nalgebra::allocator::Allocator<num::Complex<f64>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>, typenum::B0>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>> typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>, typenum::B0> : nalgebra::DimName
error[E0277]: the trait bound typenum::UTerm: nalgebra::DimName is not satisfied
--> src/main.rs:11:13
|
11 | let c = nalgebra::MatrixMN::<Complex64,typenum::U6,typenum::U1024>::from_fn(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait nalgebra::DimName is not implemented for typenum::UTerm
|
= note: required because of the requirements on the impl of nalgebra::DimName for typenum::UInt<typenum::UTerm, typenum::B1>
= note: required because of the requirements on the impl of nalgebra::DimName for typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>
= note: required because of the requirements on the impl of nalgebra::DimName for typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>, typenum::B0>
= note: required because of the requirements on the impl of nalgebra::allocator::Allocator<num::Complex<f64>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B1>, typenum::B0>, typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>, typenum::B0>> for nalgebra::DefaultAllocator
error: aborting due to 2 previous errors
Some errors occurred: E0277, E0599.
For more information about an error, try rustc --explain E0277.
error: Could not compile complex.
To learn more, run the command again with --verbose.
The text was updated successfully, but these errors were encountered:
Hi! For static dimensions up to 127 (included), you need to use the nalgebra type-level const: nalgebra::MatrixMN::<Complex64, nalgebra::U6, typenum::U1024>::from_fn(
The following code for generating large random complex matrices doesn't seem to work.
The compiler output is:
The text was updated successfully, but these errors were encountered: