| 230 | |
| 231 | |
| 232 | Bayes_base::Float Information_root_scheme::observe_innovation (Linrz_correlated_observe_model& h, const FM::Vec& s) |
| 233 | /* Extended linrz correlated observe |
| 234 | * Precondition: |
| 235 | * r(k+1|k),R(k+1|k) |
| 236 | * Postcondition: |
| 237 | * r(k+1|k+1),R(k+1|k+1) |
| 238 | * |
| 239 | * Uses LAPACK geqrf for QR decomposition (without PIVOTING) |
| 240 | * ISSUE correctness of linrz form needs validation |
| 241 | */ |
| 242 | { |
| 243 | const std::size_t x_size = x.size(); |
| 244 | const std::size_t z_size = s.size(); |
| 245 | // Size consistency, z to model |
| 246 | if (z_size != h.Z.size1()) |
| 247 | error (Logic_exception("observation and model size inconsistent")); |
| 248 | |
| 249 | // Require Inverse of Root of uncorrelated observe noise |
| 250 | UTriMatrix Zir(z_size,z_size); |
| 251 | Float rcond = UCfactor (Zir, h.Z); |
| 252 | rclimit.check_PD(rcond, "Z not PD"); |
| 253 | bool singular = UTinverse (Zir); |
| 254 | assert (!singular); (void)singular; |
| 255 | // Form Augmented matrix for factorisation |
| 256 | DenseColMatrix A(x_size+z_size, x_size+1); // Column major required for LAPACK, also this property is using in indexing |
| 257 | A.sub_matrix(0,x_size, 0,x_size) .assign (R); |
| 258 | A.sub_matrix(x_size,x_size+z_size, 0,x_size) .assign (prod(Zir, h.Hx)); |
| 259 | A.sub_column(0,x_size, x_size) .assign (r); |
| 260 | A.sub_column(x_size,x_size+z_size, x_size) .assign (prod(Zir, s+prod(h.Hx,x))); |
| 261 | |
| 262 | // Calculate factorisation so we have and upper triangular R |
| 263 | DenseVec tau(x_size+1); |
| 264 | int info = LAPACK::geqrf (A, tau); |
| 265 | if (info != 0) |
| 266 | error (Numeric_exception("Observe no QR factor")); |
| 267 | // Extract the roots, junk in strict lower triangle |
| 268 | noalias(R) = UpperTri( A.sub_matrix(0,x_size, 0,x_size) ); |
| 269 | noalias(r) = A.sub_column(0,x_size, x_size); |
| 270 | |
| 271 | return UCrcond(R); // compute rcond of result |
| 272 | } |
| 273 | |
| 274 | |
| 275 | Bayes_base::Float Information_root_scheme::observe_innovation (Linrz_uncorrelated_observe_model& h, const FM::Vec& s) |
nothing calls this directly
no test coverage detected