renamed sparse to sparseJacobian_
parent
0a101eb50f
commit
03280f2446
|
@ -74,12 +74,14 @@ initialEstimate.print('initial estimate');
|
||||||
result = graph.optimize_(initialEstimate);
|
result = graph.optimize_(initialEstimate);
|
||||||
result.print('final result');
|
result.print('final result');
|
||||||
|
|
||||||
%% Print out the corresponding dense matrix
|
%% Get the corresponding dense matrix
|
||||||
ord = graph.orderingCOLAMD(result);
|
ord = graph.orderingCOLAMD(result);
|
||||||
gfg = graph.linearize(result,ord);
|
gfg = graph.linearize(result,ord);
|
||||||
denseAb = gfg.denseJacobian
|
denseAb = gfg.denseJacobian;
|
||||||
|
|
||||||
%% Get sparse matrix
|
%% Get sparse matrix A and RHS b
|
||||||
IJS = gfg.sparse();
|
IJS = gfg.sparseJacobian_();
|
||||||
Ab=sparse(IJS(1,:),IJS(2,:),IJS(3,:));
|
Ab=sparse(IJS(1,:),IJS(2,:),IJS(3,:));
|
||||||
spy(Ab(:,1:end-1));
|
A = Ab(:,1:end-1);
|
||||||
|
b = full(Ab(:,end));
|
||||||
|
spy(A);
|
||||||
|
|
2
gtsam.h
2
gtsam.h
|
@ -110,7 +110,7 @@ class GaussianFactorGraph {
|
||||||
void combine(const GaussianFactorGraph& lfg);
|
void combine(const GaussianFactorGraph& lfg);
|
||||||
Matrix denseJacobian() const;
|
Matrix denseJacobian() const;
|
||||||
Matrix denseHessian() const;
|
Matrix denseHessian() const;
|
||||||
Matrix sparse() const;
|
Matrix sparseJacobian_() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Landmark2 {
|
class Landmark2 {
|
||||||
|
|
|
@ -141,7 +141,7 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
Matrix GaussianFactorGraph::sparse() const {
|
Matrix GaussianFactorGraph::sparseJacobian_() const {
|
||||||
|
|
||||||
// call sparseJacobian
|
// call sparseJacobian
|
||||||
typedef boost::tuple<size_t, size_t, double> triplet;
|
typedef boost::tuple<size_t, size_t, double> triplet;
|
||||||
|
|
|
@ -160,7 +160,7 @@ namespace gtsam {
|
||||||
* such that S(i(k),j(k)) = s(k), which can be given to MATLAB's sparse.
|
* such that S(i(k),j(k)) = s(k), which can be given to MATLAB's sparse.
|
||||||
* The standard deviations are baked into A and b
|
* The standard deviations are baked into A and b
|
||||||
*/
|
*/
|
||||||
Matrix sparse() const;
|
Matrix sparseJacobian_() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a dense \f$ m \times n \f$ Jacobian matrix, augmented with b
|
* Return a dense \f$ m \times n \f$ Jacobian matrix, augmented with b
|
||||||
|
|
Loading…
Reference in New Issue