reapply a bug fix in isConstrained when no model exists
parent
48b08bd58e
commit
2673e1664c
|
|
@ -580,10 +580,6 @@ void JacobianFactor::gradientAtZero(double* d) const {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
Vector JacobianFactor::gradient(Key key, const VectorValues& x) const {
|
Vector JacobianFactor::gradient(Key key, const VectorValues& x) const {
|
||||||
if (isConstrained()) { // Untested. But see the explanation in gradientAtZero()
|
|
||||||
Matrix A = getA(find(key));
|
|
||||||
return A.transpose()*ones(rows());
|
|
||||||
}
|
|
||||||
// TODO: optimize it for JacobianFactor without converting to a HessianFactor
|
// TODO: optimize it for JacobianFactor without converting to a HessianFactor
|
||||||
HessianFactor hessian(*this);
|
HessianFactor hessian(*this);
|
||||||
return hessian.gradient(key, x);
|
return hessian.gradient(key, x);
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,9 @@ namespace gtsam {
|
||||||
virtual bool empty() const { return size() == 0 /*|| rows() == 0*/; }
|
virtual bool empty() const { return size() == 0 /*|| rows() == 0*/; }
|
||||||
|
|
||||||
/** is noise model constrained ? */
|
/** is noise model constrained ? */
|
||||||
bool isConstrained() const { return model_->isConstrained(); }
|
bool isConstrained() const {
|
||||||
|
return model_ && model_->isConstrained();
|
||||||
|
}
|
||||||
|
|
||||||
/** 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?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue