38 #include <visp3/core/vpSubMatrix.h>
39 #include <visp3/core/vpException.h>
40 #include <visp3/core/vpMatrixException.h>
41 #include <visp3/core/vpDebug.h>
45 : pRowNum(0), pColNum(0), parent(NULL)
58 const unsigned int & nrows,
const unsigned int & ncols)
59 : pRowNum(0), pColNum(0), parent(NULL)
61 init(m,row_offset,col_offset,nrows,ncols);
72 void vpSubMatrix::init(
vpMatrix &m,
const unsigned int &row_offset,
const unsigned int &col_offset ,
const unsigned int & nrows ,
const unsigned int & ncols){
75 vpERROR_TRACE(
"\n\t\t SubMatrix parent matrix is not allocated") ;
77 "\n\t\t SubMatrix parent matrix is not allocated")) ;
80 if(row_offset+nrows <= m.
getRows() && col_offset+ncols <= m.
getCols()){
91 rowPtrs=(
double**) malloc(nrows *
sizeof(
double*));
92 for(
unsigned int r=0;r<nrows;r++)
97 vpERROR_TRACE(
"Submatrix cannot be contain in parent matrix") ;
108 vpERROR_TRACE(
"\n\t\t vpSubMatrix parent vpMatrix has been destroyed");
110 "\n\t\t \n\t\t vpSubMatrix parent vpMatrix has been destroyed")) ;
113 vpERROR_TRACE(
"\n\t\t vpSubMatrix size of parent vpMatrix has been changed");
115 "\n\t\t \n\t\t vpSubMatrix size of parent vpMatrix has been changed")) ;
127 vpERROR_TRACE(
"\n\t\t vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix") ;
129 "\n\t\t \n\t\t vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix")) ;
132 for (
unsigned int i=0;i<
rowNum;i++)
133 for(
unsigned int j=0;j<
colNum;j++)
147 vpERROR_TRACE(
"\n\t\t vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix") ;
149 "\n\t\t \n\t\t vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix")) ;
155 for (
unsigned int i=0;i<
rowNum;i++)
156 for(
unsigned int j=0;j<
colNum;j++)
157 rowPtrs[i][j] = BrowPtrs[i][j];
167 for (
unsigned int i=0;i<
rowNum;i++)
168 for(
unsigned int j=0;j<
colNum;j++)
Implementation of a matrix and operations on matrices.
void checkParentStatus() const
Check is parent vpRowVector has changed since initialization.
Type * data
Address of the first element of the data array.
unsigned int getCols() const
Return the number of columns of the 2D array.
Definition of the vpSubMatrix vpSubMatrix class provides a mask on a vpMatrix all properties of vpMat...
unsigned int rowNum
Number of rows in the array.
~vpSubMatrix()
Destructor.
vp_deprecated void init()
unsigned int getRows() const
Return the number of rows of the 2D array.
unsigned int colNum
Number of columns in the array.
vpSubMatrix & operator=(const vpSubMatrix &B)
Operation such as subA = subB.
error that can be emited by the vpMatrix class and its derivates
unsigned int dsize
Current array size (rowNum * colNum)
double ** rowPtrs
Address of the first element of each rows.
vpSubMatrix()
Default constructor.