Merge pull request #228 from borglab/fix/override_warnings
Added override everywhere where it was neededrelease/4.3a0
commit
09b0f03542
|
@ -186,25 +186,28 @@ namespace gtsam {
|
||||||
virtual ~HessianFactor() {}
|
virtual ~HessianFactor() {}
|
||||||
|
|
||||||
/** Clone this HessianFactor */
|
/** Clone this HessianFactor */
|
||||||
virtual GaussianFactor::shared_ptr clone() const {
|
GaussianFactor::shared_ptr clone() const override {
|
||||||
return boost::make_shared<HessianFactor>(*this); }
|
return boost::make_shared<HessianFactor>(*this); }
|
||||||
|
|
||||||
/** Print the factor for debugging and testing (implementing Testable) */
|
/** Print the factor for debugging and testing (implementing Testable) */
|
||||||
virtual void print(const std::string& s = "",
|
void print(const std::string& s = "",
|
||||||
const KeyFormatter& formatter = DefaultKeyFormatter) const;
|
const KeyFormatter& formatter = DefaultKeyFormatter) const override;
|
||||||
|
|
||||||
/** Compare to another factor for testing (implementing Testable) */
|
/** Compare to another factor for testing (implementing Testable) */
|
||||||
virtual bool equals(const GaussianFactor& lf, double tol = 1e-9) const;
|
bool equals(const GaussianFactor& lf, double tol = 1e-9) const override;
|
||||||
|
|
||||||
/** Evaluate the factor error f(x), see above. */
|
/**
|
||||||
virtual double error(const VectorValues& c) const; /** 0.5*[x -1]'*H*[x -1] (also see constructor documentation) */
|
* Evaluate the factor error f(x).
|
||||||
|
* returns 0.5*[x -1]'*H*[x -1] (also see constructor documentation)
|
||||||
|
*/
|
||||||
|
double error(const VectorValues& c) const override;
|
||||||
|
|
||||||
/** Return the dimension of the variable pointed to by the given key iterator
|
/** Return the dimension of the variable pointed to by the given key iterator
|
||||||
* todo: Remove this in favor of keeping track of dimensions with variables?
|
* todo: Remove this in favor of keeping track of dimensions with variables?
|
||||||
* @param variable An iterator pointing to the slot in this factor. You can
|
* @param variable An iterator pointing to the slot in this factor. You can
|
||||||
* use, for example, begin() + 2 to get the 3rd variable in this factor.
|
* use, for example, begin() + 2 to get the 3rd variable in this factor.
|
||||||
*/
|
*/
|
||||||
virtual DenseIndex getDim(const_iterator variable) const {
|
DenseIndex getDim(const_iterator variable) const override {
|
||||||
return info_.getDim(std::distance(begin(), variable));
|
return info_.getDim(std::distance(begin(), variable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,10 +219,10 @@ namespace gtsam {
|
||||||
* stored stored in this factor.
|
* stored stored in this factor.
|
||||||
* @return a HessianFactor with negated Hessian matrices
|
* @return a HessianFactor with negated Hessian matrices
|
||||||
*/
|
*/
|
||||||
virtual GaussianFactor::shared_ptr negate() const;
|
GaussianFactor::shared_ptr negate() const override;
|
||||||
|
|
||||||
/** Check if the factor is empty. TODO: How should this be defined? */
|
/** Check if the factor is empty. TODO: How should this be defined? */
|
||||||
virtual bool empty() const { return size() == 0 /*|| rows() == 0*/; }
|
bool empty() const override { return size() == 0 /*|| rows() == 0*/; }
|
||||||
|
|
||||||
/** Return the constant term \f$ f \f$ as described above
|
/** Return the constant term \f$ f \f$ as described above
|
||||||
* @return The constant term \f$ f \f$
|
* @return The constant term \f$ f \f$
|
||||||
|
@ -280,7 +283,7 @@ namespace gtsam {
|
||||||
* representation of the augmented information matrix, which stores only the
|
* representation of the augmented information matrix, which stores only the
|
||||||
* upper triangle.
|
* upper triangle.
|
||||||
*/
|
*/
|
||||||
virtual Matrix augmentedInformation() const;
|
Matrix augmentedInformation() const override;
|
||||||
|
|
||||||
/// Return self-adjoint view onto the information matrix (NOT augmented).
|
/// Return self-adjoint view onto the information matrix (NOT augmented).
|
||||||
Eigen::SelfAdjointView<SymmetricBlockMatrix::constBlock, Eigen::Upper> informationView() const;
|
Eigen::SelfAdjointView<SymmetricBlockMatrix::constBlock, Eigen::Upper> informationView() const;
|
||||||
|
@ -288,33 +291,33 @@ namespace gtsam {
|
||||||
/** Return the non-augmented information matrix represented by this
|
/** Return the non-augmented information matrix represented by this
|
||||||
* GaussianFactor.
|
* GaussianFactor.
|
||||||
*/
|
*/
|
||||||
virtual Matrix information() const;
|
Matrix information() const override;
|
||||||
|
|
||||||
/// Return the diagonal of the Hessian for this factor
|
/// Return the diagonal of the Hessian for this factor
|
||||||
virtual VectorValues hessianDiagonal() const;
|
VectorValues hessianDiagonal() const override;
|
||||||
|
|
||||||
/// Raw memory access version of hessianDiagonal
|
/// Raw memory access version of hessianDiagonal
|
||||||
virtual void hessianDiagonal(double* d) const;
|
void hessianDiagonal(double* d) const override;
|
||||||
|
|
||||||
/// Return the block diagonal of the Hessian for this factor
|
/// Return the block diagonal of the Hessian for this factor
|
||||||
virtual std::map<Key,Matrix> hessianBlockDiagonal() const;
|
std::map<Key,Matrix> hessianBlockDiagonal() const override;
|
||||||
|
|
||||||
/// Return (dense) matrix associated with factor
|
/// Return (dense) matrix associated with factor
|
||||||
virtual std::pair<Matrix, Vector> jacobian() const;
|
std::pair<Matrix, Vector> jacobian() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return (dense) matrix associated with factor
|
* Return (dense) matrix associated with factor
|
||||||
* The returned system is an augmented matrix: [A b]
|
* The returned system is an augmented matrix: [A b]
|
||||||
* @param set weight to use whitening to bake in weights
|
* @param set weight to use whitening to bake in weights
|
||||||
*/
|
*/
|
||||||
virtual Matrix augmentedJacobian() const;
|
Matrix augmentedJacobian() const override;
|
||||||
|
|
||||||
/** Update an information matrix by adding the information corresponding to this factor
|
/** Update an information matrix by adding the information corresponding to this factor
|
||||||
* (used internally during elimination).
|
* (used internally during elimination).
|
||||||
* @param keys THe ordered vector of keys for the information matrix to be updated
|
* @param keys THe ordered vector of keys for the information matrix to be updated
|
||||||
* @param info The information matrix to be updated
|
* @param info The information matrix to be updated
|
||||||
*/
|
*/
|
||||||
void updateHessian(const KeyVector& keys, SymmetricBlockMatrix* info) const;
|
void updateHessian(const KeyVector& keys, SymmetricBlockMatrix* info) const override;
|
||||||
|
|
||||||
/** Update another Hessian factor
|
/** Update another Hessian factor
|
||||||
* @param other the HessianFactor to be updated
|
* @param other the HessianFactor to be updated
|
||||||
|
@ -325,19 +328,19 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** y += alpha * A'*A*x */
|
/** y += alpha * A'*A*x */
|
||||||
void multiplyHessianAdd(double alpha, const VectorValues& x, VectorValues& y) const;
|
void multiplyHessianAdd(double alpha, const VectorValues& x, VectorValues& y) const override;
|
||||||
|
|
||||||
/// eta for Hessian
|
/// eta for Hessian
|
||||||
VectorValues gradientAtZero() const;
|
VectorValues gradientAtZero() const override;
|
||||||
|
|
||||||
/// Raw memory access version of gradientAtZero
|
/// Raw memory access version of gradientAtZero
|
||||||
virtual void gradientAtZero(double* d) const;
|
void gradientAtZero(double* d) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the gradient at a key:
|
* Compute the gradient at a key:
|
||||||
* \grad f(x_i) = \sum_j G_ij*x_j - g_i
|
* \grad f(x_i) = \sum_j G_ij*x_j - g_i
|
||||||
*/
|
*/
|
||||||
Vector gradient(Key key, const VectorValues& x) const;
|
Vector gradient(Key key, const VectorValues& x) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In-place elimination that returns a conditional on (ordered) keys specified, and leaves
|
* In-place elimination that returns a conditional on (ordered) keys specified, and leaves
|
||||||
|
|
|
@ -186,19 +186,19 @@ namespace gtsam {
|
||||||
virtual ~JacobianFactor() {}
|
virtual ~JacobianFactor() {}
|
||||||
|
|
||||||
/** Clone this JacobianFactor */
|
/** Clone this JacobianFactor */
|
||||||
virtual GaussianFactor::shared_ptr clone() const {
|
GaussianFactor::shared_ptr clone() const override {
|
||||||
return boost::static_pointer_cast<GaussianFactor>(
|
return boost::static_pointer_cast<GaussianFactor>(
|
||||||
boost::make_shared<JacobianFactor>(*this));
|
boost::make_shared<JacobianFactor>(*this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementing Testable interface
|
// Implementing Testable interface
|
||||||
virtual void print(const std::string& s = "",
|
void print(const std::string& s = "",
|
||||||
const KeyFormatter& formatter = DefaultKeyFormatter) const;
|
const KeyFormatter& formatter = DefaultKeyFormatter) const override;
|
||||||
virtual bool equals(const GaussianFactor& lf, double tol = 1e-9) const;
|
bool equals(const GaussianFactor& lf, double tol = 1e-9) const override;
|
||||||
|
|
||||||
Vector unweighted_error(const VectorValues& c) const; /** (A*x-b) */
|
Vector unweighted_error(const VectorValues& c) const; /** (A*x-b) */
|
||||||
Vector error_vector(const VectorValues& c) const; /** (A*x-b)/sigma */
|
Vector error_vector(const VectorValues& c) const; /** (A*x-b)/sigma */
|
||||||
virtual double error(const VectorValues& c) const; /** 0.5*(A*x-b)'*D*(A*x-b) */
|
double error(const VectorValues& c) const override; /** 0.5*(A*x-b)'*D*(A*x-b) */
|
||||||
|
|
||||||
/** Return the augmented information matrix represented by this GaussianFactor.
|
/** Return the augmented information matrix represented by this GaussianFactor.
|
||||||
* The augmented information matrix contains the information matrix with an
|
* The augmented information matrix contains the information matrix with an
|
||||||
|
@ -208,26 +208,26 @@ namespace gtsam {
|
||||||
* augmented information matrix is described in more detail in HessianFactor,
|
* augmented information matrix is described in more detail in HessianFactor,
|
||||||
* which in fact stores an augmented information matrix.
|
* which in fact stores an augmented information matrix.
|
||||||
*/
|
*/
|
||||||
virtual Matrix augmentedInformation() const;
|
Matrix augmentedInformation() const override;
|
||||||
|
|
||||||
/** Return the non-augmented information matrix represented by this
|
/** Return the non-augmented information matrix represented by this
|
||||||
* GaussianFactor.
|
* GaussianFactor.
|
||||||
*/
|
*/
|
||||||
virtual Matrix information() const;
|
Matrix information() const override;
|
||||||
|
|
||||||
/// Return the diagonal of the Hessian for this factor
|
/// Return the diagonal of the Hessian for this factor
|
||||||
virtual VectorValues hessianDiagonal() const;
|
VectorValues hessianDiagonal() const override;
|
||||||
|
|
||||||
/// Raw memory access version of hessianDiagonal
|
/// Raw memory access version of hessianDiagonal
|
||||||
virtual void hessianDiagonal(double* d) const;
|
void hessianDiagonal(double* d) const override;
|
||||||
|
|
||||||
/// Return the block diagonal of the Hessian for this factor
|
/// Return the block diagonal of the Hessian for this factor
|
||||||
virtual std::map<Key,Matrix> hessianBlockDiagonal() const;
|
std::map<Key,Matrix> hessianBlockDiagonal() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns (dense) A,b pair associated with factor, bakes in the weights
|
* @brief Returns (dense) A,b pair associated with factor, bakes in the weights
|
||||||
*/
|
*/
|
||||||
virtual std::pair<Matrix, Vector> jacobian() const;
|
std::pair<Matrix, Vector> jacobian() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns (dense) A,b pair associated with factor, does not bake in weights
|
* @brief Returns (dense) A,b pair associated with factor, does not bake in weights
|
||||||
|
@ -237,7 +237,7 @@ namespace gtsam {
|
||||||
/** Return (dense) matrix associated with factor. The returned system is an augmented matrix:
|
/** Return (dense) matrix associated with factor. The returned system is an augmented matrix:
|
||||||
* [A b]
|
* [A b]
|
||||||
* weights are baked in */
|
* weights are baked in */
|
||||||
virtual Matrix augmentedJacobian() const;
|
Matrix augmentedJacobian() const override;
|
||||||
|
|
||||||
/** Return (dense) matrix associated with factor. The returned system is an augmented matrix:
|
/** Return (dense) matrix associated with factor. The returned system is an augmented matrix:
|
||||||
* [A b]
|
* [A b]
|
||||||
|
@ -255,10 +255,10 @@ namespace gtsam {
|
||||||
* stored stored in this factor.
|
* stored stored in this factor.
|
||||||
* @return a HessianFactor with negated Hessian matrices
|
* @return a HessianFactor with negated Hessian matrices
|
||||||
*/
|
*/
|
||||||
virtual GaussianFactor::shared_ptr negate() const;
|
GaussianFactor::shared_ptr negate() const override;
|
||||||
|
|
||||||
/** Check if the factor is empty. TODO: How should this be defined? */
|
/** Check if the factor is empty. TODO: How should this be defined? */
|
||||||
virtual bool empty() const { return size() == 0 /*|| rows() == 0*/; }
|
bool empty() const override { return size() == 0 /*|| rows() == 0*/; }
|
||||||
|
|
||||||
/** is noise model constrained ? */
|
/** is noise model constrained ? */
|
||||||
bool isConstrained() const {
|
bool isConstrained() const {
|
||||||
|
@ -268,7 +268,9 @@ namespace gtsam {
|
||||||
/** Return the dimension of the variable pointed to by the given key iterator
|
/** Return the dimension of the variable pointed to by the given key iterator
|
||||||
* todo: Remove this in favor of keeping track of dimensions with variables?
|
* todo: Remove this in favor of keeping track of dimensions with variables?
|
||||||
*/
|
*/
|
||||||
virtual DenseIndex getDim(const_iterator variable) const { return Ab_(variable - begin()).cols(); }
|
DenseIndex getDim(const_iterator variable) const override {
|
||||||
|
return Ab_(variable - begin()).cols();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return the number of rows in the corresponding linear system
|
* return the number of rows in the corresponding linear system
|
||||||
|
@ -309,17 +311,19 @@ namespace gtsam {
|
||||||
* @param scatter A mapping from variable index to slot index in this HessianFactor
|
* @param scatter A mapping from variable index to slot index in this HessianFactor
|
||||||
* @param info The information matrix to be updated
|
* @param info The information matrix to be updated
|
||||||
*/
|
*/
|
||||||
void updateHessian(const KeyVector& keys, SymmetricBlockMatrix* info) const;
|
void updateHessian(const KeyVector& keys, SymmetricBlockMatrix* info) const override;
|
||||||
|
|
||||||
/** Return A*x */
|
/** Return A*x */
|
||||||
Vector operator*(const VectorValues& x) const;
|
Vector operator*(const VectorValues& x) const;
|
||||||
|
|
||||||
/** x += A'*e. If x is initially missing any values, they are created and assumed to start as
|
/** x += alpha * A'*e. If x is initially missing any values, they are
|
||||||
* zero vectors. */
|
* created and assumed to start as zero vectors. */
|
||||||
void transposeMultiplyAdd(double alpha, const Vector& e, VectorValues& x) const;
|
void transposeMultiplyAdd(double alpha, const Vector& e,
|
||||||
|
VectorValues& x) const;
|
||||||
|
|
||||||
/** y += alpha * A'*A*x */
|
/** y += alpha * A'*A*x */
|
||||||
void multiplyHessianAdd(double alpha, const VectorValues& x, VectorValues& y) const;
|
void multiplyHessianAdd(double alpha, const VectorValues& x,
|
||||||
|
VectorValues& y) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raw memory access version of multiplyHessianAdd y += alpha * A'*A*x
|
* Raw memory access version of multiplyHessianAdd y += alpha * A'*A*x
|
||||||
|
@ -333,13 +337,13 @@ namespace gtsam {
|
||||||
const std::vector<size_t>& accumulatedDims) const;
|
const std::vector<size_t>& accumulatedDims) const;
|
||||||
|
|
||||||
/// A'*b for Jacobian
|
/// A'*b for Jacobian
|
||||||
VectorValues gradientAtZero() const;
|
VectorValues gradientAtZero() const override;
|
||||||
|
|
||||||
/// A'*b for Jacobian (raw memory version)
|
/// A'*b for Jacobian (raw memory version)
|
||||||
virtual void gradientAtZero(double* d) const;
|
void gradientAtZero(double* d) const override;
|
||||||
|
|
||||||
/// Compute the gradient wrt a key at any values
|
/// Compute the gradient wrt a key at any values
|
||||||
Vector gradient(Key key, const VectorValues& x) const;
|
Vector gradient(Key key, const VectorValues& x) const override;
|
||||||
|
|
||||||
/** Return a whitened version of the factor, i.e. with unit diagonal noise model. */
|
/** Return a whitened version of the factor, i.e. with unit diagonal noise model. */
|
||||||
JacobianFactor whiten() const;
|
JacobianFactor whiten() const;
|
||||||
|
|
Loading…
Reference in New Issue