As I was reading through, wrapped all comments to fit within 80 characters.
parent
15ba23bf46
commit
298921509c
|
|
@ -26,18 +26,22 @@ namespace gtsam {
|
|||
class SymmetricBlockMatrix;
|
||||
|
||||
/**
|
||||
* This class stores a dense matrix and allows it to be accessed as a collection of vertical
|
||||
* blocks. The dimensions of the blocks are provided when constructing this class.
|
||||
* This class stores a dense matrix and allows it to be accessed as a collection
|
||||
* of vertical blocks.
|
||||
*
|
||||
* This class also has three parameters that can be changed after construction that change the
|
||||
* apparent view of the matrix without any reallocation or data copying. firstBlock() determines
|
||||
* the block that has index 0 for all operations (except for re-setting firstBlock()). rowStart()
|
||||
* determines the apparent first row of the matrix for all operations (except for setting
|
||||
* rowStart() and rowEnd()). rowEnd() determines the apparent exclusive (one-past-the-last) last
|
||||
* row for all operations. To include all rows, rowEnd() should be set to the number of rows in
|
||||
* the matrix (i.e. one after the last true row index).
|
||||
* The dimensions of the blocks are provided when constructing this class.
|
||||
*
|
||||
* @addtogroup base */
|
||||
* This class also has three parameters that can be changed after construction
|
||||
* that change the apparent view of the matrix without any reallocation or data
|
||||
* copying. firstBlock() determines the block that has index 0 for all operations
|
||||
* (except for re-setting firstBlock()). rowStart() determines the apparent
|
||||
* first row of the matrix for all operations (except for setting rowStart() and
|
||||
* rowEnd()). rowEnd() determines the apparent exclusive (one-past-the-last)
|
||||
* last row for all operations. To include all rows, rowEnd() should be set to
|
||||
* the number of rows in the matrix (i.e. one after the last true row index).
|
||||
*
|
||||
* @addtogroup base
|
||||
*/
|
||||
class GTSAM_EXPORT VerticalBlockMatrix {
|
||||
public:
|
||||
typedef VerticalBlockMatrix This;
|
||||
|
|
@ -46,11 +50,13 @@ public:
|
|||
|
||||
protected:
|
||||
Matrix matrix_; ///< The full matrix
|
||||
FastVector<DenseIndex> variableColOffsets_; ///< the starting columns of each block (0-based)
|
||||
|
||||
DenseIndex rowStart_; ///< Changes apparent matrix view, see main class comment.
|
||||
DenseIndex rowEnd_; ///< Changes apparent matrix view, see main class comment.
|
||||
DenseIndex blockStart_; ///< Changes apparent matrix view, see main class comment.
|
||||
/// the starting columns of each block (0-based)
|
||||
FastVector<DenseIndex> variableColOffsets_;
|
||||
|
||||
DenseIndex rowStart_; ///< Changes apparent matrix view, see class comments.
|
||||
DenseIndex rowEnd_; ///< Changes apparent matrix view, see class comments.
|
||||
DenseIndex blockStart_; ///< Changes apparent matrix view, see class comments.
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -70,7 +76,10 @@ public:
|
|||
assertInvariants();
|
||||
}
|
||||
|
||||
/** Construct from a container of the sizes of each vertical block and a pre-prepared matrix. */
|
||||
/**
|
||||
* 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) {
|
||||
|
|
@ -92,16 +101,19 @@ public:
|
|||
assertInvariants();
|
||||
}
|
||||
|
||||
/** Copy the block structure and resize the underlying matrix, but do not copy the matrix data.
|
||||
* If blockStart(), rowStart(), and/or rowEnd() have been modified, this copies the structure of
|
||||
* the corresponding matrix view. In the destination VerticalBlockView, blockStart() and
|
||||
* rowStart() will thus be 0, rowEnd() will be cols() of the source VerticalBlockView, and the
|
||||
* underlying matrix will be the size of the view of the source matrix. */
|
||||
/**
|
||||
* Copy the block structure and resize the underlying matrix, but do not copy
|
||||
* the matrix data. If blockStart(), rowStart(), and/or rowEnd() have been
|
||||
* modified, this copies the structure of the corresponding matrix view. In the
|
||||
* destination VerticalBlockView, blockStart() and rowStart() will thus be 0,
|
||||
* rowEnd() will be cols() of the source VerticalBlockView, and the
|
||||
* underlying matrix will be the size of the view of the source matrix.
|
||||
*/
|
||||
static VerticalBlockMatrix LikeActiveViewOf(const VerticalBlockMatrix& rhs);
|
||||
|
||||
/** Copy the block structure, but do not copy the matrix data. If blockStart() has been
|
||||
* modified, this copies the structure of the corresponding matrix view. In the destination
|
||||
* VerticalBlockMatrix, blockStart() will be 0. */
|
||||
/** Copy the block structure, but do not copy the matrix data. If blockStart()
|
||||
* has been modified, this copies the structure of the corresponding matrix
|
||||
* view. In the destination VerticalBlockMatrix, blockStart() will be 0. */
|
||||
static VerticalBlockMatrix LikeActiveViewOf(const SymmetricBlockMatrix& rhs,
|
||||
DenseIndex height);
|
||||
|
||||
|
|
@ -161,12 +173,14 @@ public:
|
|||
rangeCols);
|
||||
}
|
||||
|
||||
/** Return the full matrix, *not* including any portions excluded by rowStart(), rowEnd(), and firstBlock() */
|
||||
/** Return the full matrix, *not* including any portions excluded by
|
||||
* rowStart(), rowEnd(), and firstBlock() */
|
||||
Block full() {
|
||||
return range(0, nBlocks());
|
||||
}
|
||||
|
||||
/** Return the full matrix, *not* including any portions excluded by rowStart(), rowEnd(), and firstBlock() */
|
||||
/** Return the full matrix, *not* including any portions excluded by
|
||||
* rowStart(), rowEnd(), and firstBlock() */
|
||||
const constBlock full() const {
|
||||
return range(0, nBlocks());
|
||||
}
|
||||
|
|
@ -178,17 +192,19 @@ public:
|
|||
return variableColOffsets_[actualBlock];
|
||||
}
|
||||
|
||||
/** Get or set the apparent first row of the underlying matrix for all operations */
|
||||
/// Get/set the apparent first row of the underlying matrix for all operations
|
||||
DenseIndex& rowStart() {
|
||||
return rowStart_;
|
||||
}
|
||||
|
||||
/** Get or set the apparent last row (exclusive, i.e. rows() == rowEnd() - rowStart()) of the underlying matrix for all operations */
|
||||
/** Get/set the apparent last row
|
||||
* (exclusive, i.e. rows() == rowEnd() - rowStart())
|
||||
* of the underlying matrix for all operations */
|
||||
DenseIndex& rowEnd() {
|
||||
return rowEnd_;
|
||||
}
|
||||
|
||||
/** Get or set the apparent first block for all operations */
|
||||
/** Get/set the apparent first block for all operations */
|
||||
DenseIndex& firstBlock() {
|
||||
return blockStart_;
|
||||
}
|
||||
|
|
@ -198,7 +214,8 @@ public:
|
|||
return rowStart_;
|
||||
}
|
||||
|
||||
/** Get the apparent last row (exclusive, i.e. rows() == rowEnd() - rowStart()) of the underlying matrix for all operations */
|
||||
/** Get the apparent last row (exclusive, i.e. rows() == rowEnd() - rowStart())
|
||||
* of the underlying matrix for all operations */
|
||||
DenseIndex rowEnd() const {
|
||||
return rowEnd_;
|
||||
}
|
||||
|
|
@ -208,12 +225,14 @@ public:
|
|||
return blockStart_;
|
||||
}
|
||||
|
||||
/** Access to full matrix (*including* any portions excluded by rowStart(), rowEnd(), and firstBlock()) */
|
||||
/** Access to full matrix (*including* any portions excluded by rowStart(),
|
||||
* rowEnd(), and firstBlock()) */
|
||||
const Matrix& matrix() const {
|
||||
return matrix_;
|
||||
}
|
||||
|
||||
/** Non-const access to full matrix (*including* any portions excluded by rowStart(), rowEnd(), and firstBlock()) */
|
||||
/** Non-const access to full matrix (*including* any portions excluded by
|
||||
* rowStart(), rowEnd(), and firstBlock()) */
|
||||
Matrix& matrix() {
|
||||
return matrix_;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue