LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
infer_lqn_jacobian.h File Reference

Forward finite-difference sensitivity matrix of an observation map. More...

#include <cstddef>
#include <functional>
#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for infer_lqn_jacobian.h:

Go to the source code of this file.

Classes

struct  line::infer::JacobianResult< T >
 Mirrors the [H, h0] return list of the MATLAB function. More...

Namespaces

namespace  line
namespace  line::infer

Functions

template<class T>
JacobianResult< T > line::infer::infer_lqn_jacobian (const std::function< std::vector< T >(const std::vector< T > &)> &hfun, const std::vector< T > &a, double fd_step=1e-3, double fd_floor=1e-6)
 Forward finite-difference sensitivity matrix of an observation map.

Detailed Description

Forward finite-difference sensitivity matrix of an observation map.

Templated port of matlab/src/api/infer/infer_lqn_jacobian.m. The JAR carries the same computation inline inside jline/api/infer/InferLqn.java rather than as a separate entry point.

H = dh/da at the parameter vector a, column by column, H(:,i) = (h(a + d_i e_i) - h(a)) / d_i, d_i = fd_step max(|a_i|, fd_floor) which is the approximate sensitivity matrix H_k of the EKF update of Zheng, Yang, Woodside, Litoiu, Iszlai, "Tracking Time-Varying Parameters in Software Systems with Extended Kalman Filters", CASCON 2005. h is evaluated numel(a)+1 times, and h0 = h(a) is returned alongside because the caller (the EKF innovation) always needs it too.

The observation map is a std::function, so the rest of infer_lqn – which needs the LayeredNetwork model layer to evaluate h – stays out of this header: any caller that can evaluate h can use this.

ARITHMETIC: additions, one division per column and a comparison, so a finite field computation and no transcendental gate. Note what that does and does not buy: in the exact instantiation the returned matrix is the exact DIFFERENCE QUOTIENT of h, not the derivative – the truncation error of the forward difference is a property of the formula, not of the arithmetic.

Definition in file infer_lqn_jacobian.h.