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
When I want to use Fraction in nalgebra (a linear algebra library), there are some traits that do not meet the requirements:
fnmain(){typeFraction = fraction::Fraction;typeMatrix = nalgebra::Matrix2<Fraction>;let a = Matrix::new(Fraction::from(1),Fraction::from(2),Fraction::from(3),Fraction::from(4),);println!("{:.3}", a.try_inverse().unwrap());}
Error message:
--> src\main.rs:15:25
|
15 | println!("{:.3}", a.try_inverse().unwrap());
| ^^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds
53 | pub enum GenericFraction<T>
| ---------------------------
| |
| doesn't satisfy `<_ as SimdValue>::Element = GenericFraction<u64>`
| doesn't satisfy `<_ as SimdValue>::SimdBool = bool`
| doesn't satisfy `GenericFraction<u64>: ComplexField`
| doesn't satisfy `GenericFraction<u64>: Field`
| doesn't satisfy `GenericFraction<u64>: FromPrimitive`
| doesn't satisfy `GenericFraction<u64>: SimdValue`
| doesn't satisfy `_: SubsetOf<GenericFraction<u64>>`
| doesn't satisfy `_: SupersetOf<f64>`
|
= note: the following trait bounds were not satisfied:
`GenericFraction<u64>: ComplexField`
`<GenericFraction<u64> as SimdValue>::SimdBool = bool`
which is required by `GenericFraction<u64>: ComplexField`
`<GenericFraction<u64> as SimdValue>::Element = GenericFraction<u64>`
which is required by `GenericFraction<u64>: ComplexField`
`GenericFraction<u64>: Field`
which is required by `GenericFraction<u64>: ComplexField`
`GenericFraction<u64>: SimdValue`
which is required by `GenericFraction<u64>: ComplexField`
`GenericFraction<u64>: FromPrimitive`
which is required by `GenericFraction<u64>: ComplexField`
`GenericFraction<u64>: simba::scalar::subset::SupersetOf<f64>`
which is required by `GenericFraction<u64>: ComplexField`
`GenericFraction<u64>: simba::scalar::subset::SubsetOf<GenericFraction<u64>>`
which is required by `GenericFraction<u64>: ComplexField`
Is there any way to solve this problem?
The text was updated successfully, but these errors were encountered:
Hi @chen-qingyu, sorry to hear you have some troubles.
Unfortunately, it doesn't look like this would work, as nalgebra has a bunch of its own traits that it implements for most of the primitive types. Given that, Fraction is not among those implementations and also does not have integration with nalgebra at this stage.
I am not saying the integration between the two projects would not be possible.
However, it is not implemented at the moment and won't work out of the box without you providing those missing trait implementations.
When I want to use Fraction in nalgebra (a linear algebra library), there are some traits that do not meet the requirements:
Error message:
Is there any way to solve this problem?
The text was updated successfully, but these errors were encountered: