43 #include <visp/vpSubMatrix.h>
44 #include <visp/vpException.h>
45 #include <visp/vpMatrixException.h>
46 #include <visp/vpDebug.h>
50 : pRowNum(0), pColNum(0), parent(NULL)
63 const unsigned int & nrows,
const unsigned int & ncols)
64 : pRowNum(0), pColNum(0), parent(NULL)
66 init(m,row_offset,col_offset,nrows,ncols);
77 void vpSubMatrix::init(
vpMatrix &m,
const unsigned int &row_offset,
const unsigned int &col_offset ,
const unsigned int & nrows ,
const unsigned int & ncols){
80 vpERROR_TRACE(
"\n\t\t SubMatrix parent matrix is not allocated") ;
82 "\n\t\t SubMatrix parent matrix is not allocated")) ;
85 if(row_offset+nrows <= m.
getRows() && col_offset+ncols <= m.
getCols()){
96 rowPtrs=(
double**) malloc(nrows *
sizeof(
double*));
97 for(
unsigned int r=0;r<nrows;r++)
103 vpERROR_TRACE(
"Submatrix cannot be contain in parent matrix") ;
114 vpERROR_TRACE(
"\n\t\t vpSubMatrix parent vpMatrix has been destroyed");
116 "\n\t\t \n\t\t vpSubMatrix parent vpMatrix has been destroyed")) ;
119 vpERROR_TRACE(
"\n\t\t vpSubMatrix size of parent vpMatrix has been changed");
121 "\n\t\t \n\t\t vpSubMatrix size of parent vpMatrix has been changed")) ;
133 vpERROR_TRACE(
"\n\t\t vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix") ;
135 "\n\t\t \n\t\t vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix")) ;
138 for (
unsigned int i=0;i<
rowNum;i++)
139 for(
unsigned int j=0;j<
colNum;j++)
153 vpERROR_TRACE(
"\n\t\t vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix") ;
155 "\n\t\t \n\t\t vpSubMatrix mismatch in operator vpSubMatrix=vpMatrix")) ;
161 for (
unsigned int i=0;i<
rowNum;i++)
162 for(
unsigned int j=0;j<
colNum;j++)
163 rowPtrs[i][j] = BrowPtrs[i][j];
173 for (
unsigned int i=0;i<
rowNum;i++)
174 for(
unsigned int j=0;j<
colNum;j++)
Definition of the vpMatrix class.
void checkParentStatus()
Check is parent vpRowVector has changed since initialization.
void init()
Initialization of the object matrix.
Definition of the vpSubMatrix vpSubMatrix class provides a mask on a vpMatrix all properties of vpMat...
double * data
address of the first element of the data array
unsigned int trsize
Total row space.
double ** rowPtrs
address of the first element of each rows
~vpSubMatrix()
Destructor.
unsigned int rowNum
number of rows
unsigned int getCols() const
Return the number of columns of the matrix.
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 size (rowNum * colNum)
unsigned int colNum
number of columns
unsigned int getRows() const
Return the number of rows of the matrix.
vpSubMatrix()
Default constructor.