Add pure virtual function in GaussianFactor and empty dummy virtual function in Jacobian/Hessian Factor for the raw memory access functions
parent
9f1730809b
commit
960d10582d
|
@ -99,6 +99,9 @@ namespace gtsam {
|
|||
/// Return the diagonal of the Hessian for this factor
|
||||
virtual VectorValues hessianDiagonal() const = 0;
|
||||
|
||||
/// Raw memory access version of hessianDiagonal
|
||||
virtual void hessianDiagonal(double* d) const = 0;
|
||||
|
||||
/// Return the block diagonal of the Hessian for this factor
|
||||
virtual std::map<Key,Matrix> hessianBlockDiagonal() const = 0;
|
||||
|
||||
|
@ -121,6 +124,9 @@ namespace gtsam {
|
|||
/// A'*b for Jacobian, eta for Hessian
|
||||
virtual VectorValues gradientAtZero() const = 0;
|
||||
|
||||
/// Raw memory access version of gradientAtZero
|
||||
virtual void gradientAtZero(double* d) const = 0;
|
||||
|
||||
private:
|
||||
/** Serialization function */
|
||||
friend class boost::serialization::access;
|
||||
|
|
|
@ -358,6 +358,13 @@ VectorValues HessianFactor::hessianDiagonal() const {
|
|||
return d;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
// Raw memory access version should be called in Regular Factors only currently
|
||||
void HessianFactor::hessianDiagonal(double* d) const {
|
||||
throw std::runtime_error(
|
||||
"HessianFactor::hessianDiagonal raw memory access is allowed for Regular Factors only");
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
map<Key,Matrix> HessianFactor::hessianBlockDiagonal() const {
|
||||
map<Key,Matrix> blocks;
|
||||
|
@ -540,6 +547,13 @@ VectorValues HessianFactor::gradientAtZero() const {
|
|||
return g;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
// Raw memory access version should be called in Regular Factors only currently
|
||||
void HessianFactor::gradientAtZero(double* d) const {
|
||||
throw std::runtime_error(
|
||||
"HessianFactor::gradientAtZero raw memory access is allowed for Regular Factors only");
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
std::pair<boost::shared_ptr<GaussianConditional>, boost::shared_ptr<HessianFactor> >
|
||||
EliminateCholesky(const GaussianFactorGraph& factors, const Ordering& keys)
|
||||
|
|
|
@ -340,6 +340,9 @@ namespace gtsam {
|
|||
/// Return the diagonal of the Hessian for this factor
|
||||
virtual VectorValues hessianDiagonal() const;
|
||||
|
||||
/// Raw memory access version of hessianDiagonal
|
||||
virtual void hessianDiagonal(double* d) const;
|
||||
|
||||
/// Return the block diagonal of the Hessian for this factor
|
||||
virtual std::map<Key,Matrix> hessianBlockDiagonal() const;
|
||||
|
||||
|
@ -380,6 +383,9 @@ namespace gtsam {
|
|||
/// eta for Hessian
|
||||
VectorValues gradientAtZero() const;
|
||||
|
||||
/// Raw memory access version of gradientAtZero
|
||||
virtual void gradientAtZero(double* d) const;
|
||||
|
||||
/**
|
||||
* Densely partially eliminate with Cholesky factorization. JacobianFactors are
|
||||
* left-multiplied with their transpose to form the Hessian using the conversion constructor
|
||||
|
|
|
@ -460,6 +460,13 @@ VectorValues JacobianFactor::hessianDiagonal() const {
|
|||
return d;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
// Raw memory access version should be called in Regular Factors only currently
|
||||
void JacobianFactor::hessianDiagonal(double* d) const {
|
||||
throw std::runtime_error(
|
||||
"JacobianFactor::hessianDiagonal raw memory access is allowed for Regular Factors only");
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
map<Key, Matrix> JacobianFactor::hessianBlockDiagonal() const {
|
||||
map<Key, Matrix> blocks;
|
||||
|
@ -520,6 +527,13 @@ VectorValues JacobianFactor::gradientAtZero() const {
|
|||
return g;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
// Raw memory access version should be called in Regular Factors only currently
|
||||
void JacobianFactor::gradientAtZero(double* d) const {
|
||||
throw std::runtime_error(
|
||||
"JacobianFactor::gradientAtZero raw memory access is allowed for Regular Factors only");
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
pair<Matrix, Vector> JacobianFactor::jacobian() const {
|
||||
pair<Matrix, Vector> result = jacobianUnweighted();
|
||||
|
|
|
@ -185,6 +185,9 @@ namespace gtsam {
|
|||
/// Return the diagonal of the Hessian for this factor
|
||||
virtual VectorValues hessianDiagonal() const;
|
||||
|
||||
/// Raw memory access version of hessianDiagonal
|
||||
virtual void hessianDiagonal(double* d) const;
|
||||
|
||||
/// Return the block diagonal of the Hessian for this factor
|
||||
virtual std::map<Key,Matrix> hessianBlockDiagonal() const;
|
||||
|
||||
|
@ -279,6 +282,9 @@ namespace gtsam {
|
|||
/// A'*b for Jacobian
|
||||
VectorValues gradientAtZero() const;
|
||||
|
||||
/// Raw memory access version of gradientAtZero
|
||||
virtual void gradientAtZero(double* d) const;
|
||||
|
||||
/** Return a whitened version of the factor, i.e. with unit diagonal noise model. */
|
||||
JacobianFactor whiten() const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue