SymmetricBlockMatrix.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
21 #include <gtsam/base/cholesky.h>
22 #include <gtsam/base/timing.h>
24 
25 namespace gtsam {
26 
27 /* ************************************************************************* */
29  const SymmetricBlockMatrix& other) {
31  result.variableColOffsets_.resize(other.nBlocks() + 1);
32  for (size_t i = 0; i < result.variableColOffsets_.size(); ++i)
34  + i] - other.variableColOffsets_[other.blockStart_];
35  result.matrix_.resize(other.cols(), other.cols());
36  result.assertInvariants();
37  return result;
38 }
39 
40 /* ************************************************************************* */
42  const VerticalBlockMatrix& other) {
44  result.variableColOffsets_.resize(other.nBlocks() + 1);
45  for (size_t i = 0; i < result.variableColOffsets_.size(); ++i)
47  + i] - other.variableColOffsets_[other.blockStart_];
48  result.matrix_.resize(other.cols(), other.cols());
49  result.assertInvariants();
50  return result;
51 }
52 
53 /* ************************************************************************* */
55  if (I == J) {
56  return diagonalBlock(I);
57  } else if (I < J) {
58  return aboveDiagonalBlock(I, J);
59  } else {
60  return aboveDiagonalBlock(J, I).transpose();
61  }
62 }
63 
64 /* ************************************************************************* */
66  gttic(VerticalBlockMatrix_choleskyPartial);
68  if (!gtsam::choleskyPartial(matrix_, offset(nFrontals) - topleft, topleft)) {
69  throw CholeskyFailed();
70  }
71 }
72 
73 /* ************************************************************************* */
75  gttic(VerticalBlockMatrix_split);
76 
77  // Construct a VerticalBlockMatrix that contains [R Sd]
78  const size_t n1 = offset(nFrontals);
80 
81  // Copy into it.
82  RSd.full() = matrix_.topRows(n1);
83  RSd.full().triangularView<Eigen::StrictlyLower>().setZero();
84 
85  // Take lower-right block of Ab_ to get the remaining factor
86  blockStart() = nFrontals;
87 
88  return RSd;
89 }
90 
91 /* ************************************************************************* */
92 
93 } //\ namespace gtsam
94 
DenseIndex offset(DenseIndex block) const
Get an offset for a block index (in the active view).
Access to matrices via blocks of pre-defined sizes. Used in GaussianFactor and GaussianConditional.
FastVector< DenseIndex > variableColOffsets_
the starting columns of each block (0-based)
A matrix with column blocks of pre-defined sizes. Used in JacobianFactor and GaussianConditional.
Matrix matrix_
The full matrix.
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:43
DenseIndex blockStart_
Changes apparent matrix view, see main class comment.
static SymmetricBlockMatrix LikeActiveViewOf(const SymmetricBlockMatrix &other)
ptrdiff_t DenseIndex
The index type for Eigen objects.
Definition: types.h:67
#define gttic(label)
Definition: timing.h:280
DenseIndex nBlocks() const
Block count.
Values result
constBlock aboveDiagonalBlock(DenseIndex I, DenseIndex J) const
Get block above the diagonal (I, J).
static const Matrix I
Definition: lago.cpp:35
JacobiRotation< float > J
bool choleskyPartial(Matrix &ABC, size_t nFrontal, size_t topleft)
traits
Definition: chartTesting.h:28
Matrix block(DenseIndex I, DenseIndex J) const
VerticalBlockMatrix split(DenseIndex nFrontals)
static VerticalBlockMatrix LikeActiveViewOf(const VerticalBlockMatrix &rhs)
void choleskyPartial(DenseIndex nFrontals)
void setZero()
Set the entire active matrix zero.
DenseIndex cols() const
Column size.
FastVector< DenseIndex > variableColOffsets_
the starting columns of each block (0-based)
DenseIndex blockStart_
Changes apparent matrix view, see main class comment.
Indicate Cholesky factorization failure.
Eigen::SelfAdjointView< Block, Eigen::Upper > diagonalBlock(DenseIndex J)
Return the J&#39;th diagonal block as a self adjoint view.
DenseIndex cols() const
Column size.
DenseIndex nBlocks() const
Block count.
Timing utilities.
Efficient incomplete Cholesky on rank-deficient matrices, todo: constrained Cholesky.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:45:07