Format using BORG conventions
parent
6a8084ee02
commit
b7cbc7a66f
|
@ -24,37 +24,38 @@
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
SymmetricBlockMatrix SymmetricBlockMatrix::LikeActiveViewOf(const SymmetricBlockMatrix& other)
|
SymmetricBlockMatrix SymmetricBlockMatrix::LikeActiveViewOf(
|
||||||
{
|
const SymmetricBlockMatrix& other) {
|
||||||
SymmetricBlockMatrix result;
|
SymmetricBlockMatrix result;
|
||||||
result.variableColOffsets_.resize(other.nBlocks() + 1);
|
result.variableColOffsets_.resize(other.nBlocks() + 1);
|
||||||
for (size_t i = 0; i < result.variableColOffsets_.size(); ++i)
|
for (size_t i = 0; i < result.variableColOffsets_.size(); ++i)
|
||||||
result.variableColOffsets_[i] =
|
result.variableColOffsets_[i] = other.variableColOffsets_[other.blockStart_
|
||||||
other.variableColOffsets_[other.blockStart_ + i] - other.variableColOffsets_[other.blockStart_];
|
+ i] - other.variableColOffsets_[other.blockStart_];
|
||||||
result.matrix_.resize(other.cols(), other.cols());
|
result.matrix_.resize(other.cols(), other.cols());
|
||||||
result.assertInvariants();
|
result.assertInvariants();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
SymmetricBlockMatrix SymmetricBlockMatrix::LikeActiveViewOf(const VerticalBlockMatrix& other)
|
SymmetricBlockMatrix SymmetricBlockMatrix::LikeActiveViewOf(
|
||||||
{
|
const VerticalBlockMatrix& other) {
|
||||||
SymmetricBlockMatrix result;
|
SymmetricBlockMatrix result;
|
||||||
result.variableColOffsets_.resize(other.nBlocks() + 1);
|
result.variableColOffsets_.resize(other.nBlocks() + 1);
|
||||||
for (size_t i = 0; i < result.variableColOffsets_.size(); ++i)
|
for (size_t i = 0; i < result.variableColOffsets_.size(); ++i)
|
||||||
result.variableColOffsets_[i] =
|
result.variableColOffsets_[i] = other.variableColOffsets_[other.blockStart_
|
||||||
other.variableColOffsets_[other.blockStart_ + i] - other.variableColOffsets_[other.blockStart_];
|
+ i] - other.variableColOffsets_[other.blockStart_];
|
||||||
result.matrix_.resize(other.cols(), other.cols());
|
result.matrix_.resize(other.cols(), other.cols());
|
||||||
result.assertInvariants();
|
result.assertInvariants();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
VerticalBlockMatrix SymmetricBlockMatrix::choleskyPartial(DenseIndex nFrontals)
|
VerticalBlockMatrix SymmetricBlockMatrix::choleskyPartial(
|
||||||
{
|
DenseIndex nFrontals) {
|
||||||
// Do dense elimination
|
// Do dense elimination
|
||||||
if (!blockStart() == 0)
|
if (!blockStart() == 0)
|
||||||
throw std::invalid_argument("Can only do Cholesky when the SymmetricBlockMatrix is not a restricted view, i.e. when blockStart == 0.");
|
throw std::invalid_argument(
|
||||||
|
"Can only do Cholesky when the SymmetricBlockMatrix is not a restricted view, i.e. when blockStart == 0.");
|
||||||
if (!gtsam::choleskyPartial(matrix_, offset(nFrontals)))
|
if (!gtsam::choleskyPartial(matrix_, offset(nFrontals)))
|
||||||
throw CholeskyFailed();
|
throw CholeskyFailed();
|
||||||
|
|
||||||
|
@ -75,4 +76,7 @@ namespace gtsam {
|
||||||
|
|
||||||
return Ab;
|
return Ab;
|
||||||
}
|
}
|
||||||
}
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
} //\ namespace gtsam
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue