Exemplo n.º 1
0
    void predict_obsrv(Tuple& models_tuple,
                       double delta_time,
                       const State& state,
                       const Noise& noise,
                       Obsrv& prediction,
                       const int obsrv_offset = 0,
                       const int state_offset = 0,
                       const int noise_offset = 0)
    {
        auto&& model = std::get<k>(models_tuple);

        const auto obsrv_dim = model->obsrv_dimension();
        const auto state_dim = model->state_dimension();
        const auto noise_dim = model->noise_dimension();

        prediction.middleRows(obsrv_offset, obsrv_dim) =
            model->predict_obsrv(
                state.middleRows(state_offset, state_dim),
                noise.middleRows(noise_offset, noise_dim),
                delta_time
            );

        if (Size == k + 1) return;

        predict_obsrv<Size, k + (k + 1 < Size ? 1 : 0)>(
                    models_tuple,
                    delta_time,
                    state,
                    noise,
                    prediction,
                    obsrv_offset + obsrv_dim,
                    state_offset + state_dim,
                    noise_offset + noise_dim);
    }
Exemplo n.º 2
0
    void predict_state(Tuple& models_tuple,
                       double delta_time,
                       const State& state,
                       const Noise& noise,
                       const Input& input,
                       State& prediction,
                       const int state_offset = 0,
                       const int noise_offset = 0,
                       const int input_offset = 0)
    {
        auto&& model = std::get<k>(models_tuple);

        const auto state_dim = model.state_dimension();
        const auto noise_dim = model.noise_dimension();
        const auto input_dim = model.input_dimension();

        prediction.middleRows(state_offset, state_dim) =
            model.predict_state(
                delta_time,
                state.middleRows(state_offset, state_dim),
                noise.middleRows(noise_offset, noise_dim),
                input.middleRows(input_offset, input_dim)
            );

        if (Size == k + 1) return;

        predict_state<Size, k + (k + 1 < Size ? 1 : 0)>(
                    models_tuple,
                    delta_time,
                    state,
                    noise,
                    input,
                    prediction,
                    state_offset + state_dim,
                    noise_offset + noise_dim,
                    input_offset + input_dim);
    }