Sorry, I’m going getting around to implementing this now. I’ve got some compilation error I haven’t yet figured out, and was wondering if you could help.
Error
error[E0034]: multiple applicable items in scope
--> src/od/srif.rs:205:27
|
205 | let mut stacked = MatrixMN::<f64, DimNameSum<S, M>, S>::zeros();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `zeros` found
|
= note: candidate #1 is defined in an impl for the type `dynamics::na::Matrix<_, _, _, _>`
= note: candidate #2 is defined in an impl for the type `dynamics::na::Matrix<_, _, dynamics::na::Dynamic, _>`
= note: candidate #3 is defined in an impl for the type `dynamics::na::Matrix<_, dynamics::na::Dynamic, _, dynamics::na::VecStorage<_, dynamics::na::Dynamic, _>>`
= note: candidate #4 is defined in an impl for the type `dynamics::na::Matrix<_, dynamics::na::Dynamic, dynamics::na::Dynamic, dynamics::na::VecStorage<_, dynamics::na::Dynamic, _>>`
error[E0277]: cannot add `<M as dynamics::na::DimName>::Value` to `<S as dynamics::na::DimName>::Value`
--> src/od/srif.rs:205:43
|
173 | ) -> Result<(Self::Estimate, Residual<M>), FilterError> {
| - help: consider further restricting the associated type: `where <S as dynamics::na::DimName>::Value: std::ops::Add<<M as dynamics::na::DimName>::Value>`
...
205 | let mut stacked = MatrixMN::<f64, DimNameSum<S, M>, S>::zeros();
| ^^^^^^^^^^^^^^^^ no implementation for `<S as dynamics::na::DimName>::Value + <M as dynamics::na::DimName>::Value`
|
= help: the trait `std::ops::Add<<M as dynamics::na::DimName>::Value>` is not implemented for `<S as dynamics::na::DimName>::Value`
= note: required because of the requirements on the impl of `dynamics::na::DimNameAdd<M>` for `S`
error[E0277]: cannot add `<M as dynamics::na::DimName>::Value` to `<S as dynamics::na::DimName>::Value`
--> src/od/srif.rs:205:43
|
173 | ) -> Result<(Self::Estimate, Residual<M>), FilterError> {
| - help: consider further restricting the associated type: `where <S as dynamics::na::DimName>::Value: std::ops::Add<<M as dynamics::na::DimName>::Value>`
...
205 | let mut stacked = MatrixMN::<f64, DimNameSum<S, M>, S>::zeros();
| ^^^^^^^^^^^^^^^^ no implementation for `<S as dynamics::na::DimName>::Value + <M as dynamics::na::DimName>::Value`
|
= help: the trait `std::ops::Add<<M as dynamics::na::DimName>::Value>` is not implemented for `<S as dynamics::na::DimName>::Value`
= note: required because of the requirements on the impl of `dynamics::na::DimNameAdd<M>` for `S`
Relevant Code
impl<S, A, M> SRIF<S, A, M>
where
S: DimName,
A: DimName,
M: DimName,
DefaultAllocator: Allocator<f64, M>
+ Allocator<f64, S>
+ Allocator<f64, M, M>
+ Allocator<f64, M, S>
+ Allocator<f64, S, M>
+ Allocator<f64, S, S>
+ Allocator<f64, A, A>
+ Allocator<f64, S, A>
+ Allocator<f64, A, S>,
{
/// Initializes this KF with an initial estimate and measurement noise.
pub fn initialize(
initial_estimate: IfEstimate<S>,
process_noise: MatrixMN<f64, A, A>,
measurement_noise: MatrixMN<f64, M, M>,
process_noise_dt: Option<f64>,
) -> Self {
let inv_measurement_noise = measurement_noise
.try_inverse()
.expect("measurement noise singular");
Self {
prev_estimate: initial_estimate,
inv_measurement_noise,
process_noise: Some(process_noise),
process_noise_dt,
ekf: false,
h_tilde: MatrixMN::<f64, M, S>::zeros(),
stm: MatrixMN::<f64, S, S>::identity(),
stm_updated: false,
h_tilde_updated: false,
epoch_fmt: EpochFormat::MjdTai,
covar_fmt: CovarFormat::Sqrt,
}
}
}
impl<S, A, M> Filter<S, A, M> for SRIF<S, A, M>
where
S: DimName,
A: DimName,
M: DimName,
DefaultAllocator: Allocator<f64, M>
+ Allocator<f64, S>
+ Allocator<f64, M, M>
+ Allocator<f64, M, S>
+ Allocator<f64, S, M>
+ Allocator<f64, S, S>
+ Allocator<f64, A, A>
+ Allocator<f64, S, A>
+ Allocator<f64, A, S>
+ Allocator<f64, S, U1>,
{
type Estimate = IfEstimate<S>;
/// ... some functions ...
fn measurement_update(
&mut self,
dt: Epoch,
real_obs: VectorN<f64, M>,
computed_obs: VectorN<f64, M>,
) -> Result<(Self::Estimate, Residual<M>), FilterError> {
/// ... some code
/// Erroring line
let mut stacked = MatrixMN::<f64, DimNameSum<S, M>, S>::zeros();