我想创建一个包含
尝试按照错误消息进行操作会导致下一个trait错误消息的问题。我查看了nalgebra的API,其中没有包含这样复杂的trait链。例如,to_homogenous方法。我不确定我的方法是否正确。
还有一个trait Dim及其对应的DimAdd和DimSum,但由于nalgebra的这部分并没有真正记录,
我不知道我是否走在正确的道路上,或者我想做的事情是否可能。
nalgebra::MatrixN
的struct
,这个矩阵要比原先的 U1
更大:extern crate nalgebra as na;
use na::{DimName, DimNameAdd, DimNameSum, MatrixN, U1};
pub struct Homogenous<D: DimName>
where
D: DimNameAdd<U1>,
{
mat: na::MatrixN<f32, DimNameSum<D, U1>>,
}
I get the following error:
error[E0277]: cannot multiply `<<D as na::DimNameAdd<na::U1>>::Output as na::DimName>::Value` to `<<D as na::DimNameAdd<na::U1>>::Output as na::DimName>::Value`
--> src/main.rs:9:5
|
9 | mat: na::MatrixN<f32, DimNameSum<D, U1>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `<<D as na::DimNameAdd<na::U1>>::Output as na::DimName>::Value * <<D as na::DimNameAdd<na::U1>>::Output as na::DimName>::Value`
|
= help: the trait `std::ops::Mul` is not implemented for `<<D as na::DimNameAdd<na::U1>>::Output as na::DimName>::Value`
= help: consider adding a `where <<D as na::DimNameAdd<na::U1>>::Output as na::DimName>::Value: std::ops::Mul` bound
= note: required because of the requirements on the impl of `na::allocator::Allocator<f32, <D as na::DimNameAdd<na::U1>>::Output, <D as na::DimNameAdd<na::U1>>::Output>` for `na::DefaultAllocator`
尝试按照错误消息进行操作会导致下一个trait错误消息的问题。我查看了nalgebra的API,其中没有包含这样复杂的trait链。例如,to_homogenous方法。我不确定我的方法是否正确。
还有一个trait Dim及其对应的DimAdd和DimSum,但由于nalgebra的这部分并没有真正记录,
我不知道我是否走在正确的道路上,或者我想做的事情是否可能。
to_homogenous
方法。我甚至不确定我的方法是否正确。 - fujina::Matrix
->na::MatrixN
)。编译现在会导致上述错误。不幸的是,似乎 Rust playground 不支持 nalgebra。 - fuji