35 #include <visp3/core/vpDebug.h>
36 #include <visp3/core/vpException.h>
37 #include <visp3/core/vpMatrixException.h>
38 #include <visp3/core/vpSubMatrix.h>
52 const unsigned int &nrows,
const unsigned int &ncols)
53 : pRowNum(0), pColNum(0), parent(nullptr)
55 init(m, row_offset, col_offset, nrows, ncols);
67 const unsigned int &nrows,
const unsigned int &ncols)
74 if (((row_offset + nrows) <= m.
getRows()) && ((col_offset + ncols) <= m.
getCols())) {
86 rowPtrs = (
double **)malloc(nrows *
sizeof(
double *));
87 for (
unsigned int r = 0; r < nrows; ++r) {
107 "vpSubMatrix parent vpMatrix has been destroyed"));
111 "vpSubMatrix size of parent vpMatrix has been changed"));
124 "vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix"));
127 for (
unsigned int i = 0; i <
rowNum; ++i) {
128 for (
unsigned int j = 0; j <
colNum; ++j) {
145 "vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix"));
154 for (
unsigned int i = 0; i <
rowNum; ++i) {
155 for (
unsigned int j = 0; j <
colNum; ++j) {
156 rowPtrs[i][j] = BrowPtrs[i][j];
169 for (
unsigned int i = 0; i <
rowNum; ++i) {
170 for (
unsigned int j = 0; j <
colNum; ++j) {
unsigned int getCols() const
Type * data
Address of the first element of the data array.
double ** rowPtrs
Address of the first element of each rows.
unsigned int rowNum
Number of rows in the array.
unsigned int dsize
Current array size (rowNum * colNum)
unsigned int getRows() const
unsigned int colNum
Number of columns in the array.
error that can be emitted by the vpMatrix class and its derivatives
@ incorrectMatrixSizeError
Incorrect matrix size.
@ subMatrixError
Sub operation matrix error.
Implementation of a matrix and operations on matrices.
Definition of the vpSubMatrix class that provides a mask on a vpMatrix. All properties of vpMatrix ar...
virtual ~vpSubMatrix() VP_OVERRIDE
Destructor.
void checkParentStatus() const
Check is parent vpRowVector has changed since initialization.
void init(vpMatrix &m, const unsigned int &row, const unsigned int &col, const unsigned int &nrows, const unsigned int &ncols)
Initialisation of vpMatrix.
vpSubMatrix()
Default constructor.
vpSubMatrix & operator=(const vpSubMatrix &B)
Operation such as subA = subB.