Added VerticalBlockMatrix from Matrix constructor

release/4.3a0
Richard Roberts 2013-07-16 20:22:00 +00:00
parent 13e56d1d2a
commit 14c7b6bcfc
1 changed files with 13 additions and 3 deletions

View File

@ -66,9 +66,8 @@ namespace gtsam {
variableColOffsets_.push_back(0);
}
/**
* Construct from a container of the sizes of each vertical block, resize the matrix so that its
* height is matrixNewHeight and its width fits the given block dimensions. */
/** Construct from a container of the sizes of each vertical block, resize the matrix so that
* its height is matrixNewHeight and its width fits the given block dimensions. */
template<typename CONTAINER>
VerticalBlockMatrix(const CONTAINER dimensions, DenseIndex height) :
rowStart_(0), rowEnd_(height), blockStart_(0)
@ -78,6 +77,17 @@ namespace gtsam {
assertInvariants();
}
/** Construct from a container of the sizes of each vertical block and a pre-prepared matrix. */
template<typename CONTAINER>
VerticalBlockMatrix(const CONTAINER dimensions, const Matrix& matrix) :
matrix_(matrix), rowStart_(0), rowEnd_(matrix.rows()), blockStart_(0)
{
fillOffsets(dimensions.begin(), dimensions.end());
if(variableColOffsets_.back() != matrix_.cols())
throw std::invalid_argument("Requested to create a VerticalBlockMatrix with dimensions that do not sum to the total columns of the provided matrix.");
assertInvariants();
}
/**
* Construct from iterator over the sizes of each vertical block, resize the matrix so that its
* height is matrixNewHeight and its width fits the given block dimensions. */