NormalPrior

class NormalPrior
class NormalPrior: public CostFunction {
 public:
  // Check that the number of rows in the vector b are the same as the
  // number of columns in the matrix A, crash otherwise.
  NormalPrior(const Matrix& A, const Vector& b);

  virtual bool Evaluate(double const* const* parameters,
                        double* residuals,
                        double** jacobians) const;
 };

实现以下形式的成本函数

cost(x)=A(xb)2\operatorname{cost}(x)=\|A(x-b)\|^{2}

其中,矩阵 AA 和向量 bb 是固定的,xx 是变量。如果用户想要实现以下形式的成本函数

cost(x)=(xμ)TS1(xμ)\operatorname{cost}(x)=(x-\mu)^{T} S^{-1}(x-\mu)

where, μ\mu is a vector and SS is a covariance matrix, then, A=S1/2A=S^{-1 / 2} , i.e the matrix AA is the square root of the inverse of the covariance, also known as the stiffness matrix. There are however no restrictions on the shape of AA . It is free to be rectangular, which would be the case if the covariance matrix SS is rank deficient.

Last updated