49 #include <visp/vpColVector.h>
50 #include <visp/vpException.h>
51 #include <visp/vpMatrixException.h>
52 #include <visp/vpDebug.h>
53 #include <visp/vpRotationVector.h>
78 double *vd = v.
data ;
double *d =
data ;
double *md = m.
data ;
80 for (
unsigned int i=0;i<
rowNum;i++)
81 *(vd++) = *(d++) + *(md++);
92 for (
unsigned int i=0;i<
rowNum;i++)
93 v += (*
this)[i] * m[i];
118 for (
unsigned int i=0;i<
rowNum;i++)
119 v[i] = (*
this)[i] - m[i];
129 "\n\t\t SubvpMatrix larger than vpColVector")) ;
131 init(m, r, 0, nrows, 1);
154 double *vd = A.
data ;
double *d =
data ;
156 for (
unsigned int i=0; i<
rowNum; i++)
175 double *vd = v.
data ;
double *d =
data ;
177 for (
unsigned int i=0;i<
rowNum;i++)
192 vpTRACE(
" m should be a 1 cols matrix ") ;
224 unsigned int k = v.
rowNum ;
265 for (
unsigned int i=0; i<
rowNum; i++) {
266 for (
unsigned int j=0; j<
colNum; j++) {
276 for (
unsigned int i=0; i<
rowNum; i++) {
277 for (
unsigned int j=0; j<
colNum; j++) {
289 for (
unsigned int i=0;i<
rowNum;i++)
370 double *ad = a.
data ;
double *bd = b.
data ;
373 for (
unsigned int i=0 ; i < a.
getRows() ; i++)
374 c += *(ad++)* *(bd++) ;
410 if (std::fabs(sum) > std::numeric_limits<double>::epsilon())
429 unsigned int nb_permutation = 1 ;
431 while (nb_permutation !=0 )
434 for (
unsigned int j = v.
getRows()-1 ; j >= i+1 ; j--)
436 if ((tab[j]>tab[j-1]))
438 double tmp = tab[j] ;
459 unsigned int nb_permutation = 1 ;
461 while (nb_permutation !=0 )
464 for (
unsigned int j = v.
getRows()-1 ; j >= i+1 ; j--)
466 if ((tab[j]<tab[j-1]))
468 double tmp = tab[j] ;
569 unsigned int nrA = A.
getRows();
570 unsigned int nrB = B.
getRows();
572 if (nrA == 0 && nrB == 0) {
590 for (
unsigned int i=0; i<nrA; i++)
593 for (
unsigned int i=0; i<nrB; i++)
608 double *vd = v.
data ;
609 for (
unsigned int i=0 ; i < v.
getRows() ; i++)
636 unsigned int inf, sup;
650 if (v[i] <= v[j]) inf++;
651 if (v[i] >= v[j]) sup++;
658 infsup[i] = fabs((
double)(inf-sup));
662 unsigned int imin=0 ;
699 "v has not 3 rows") ;
701 "\n\t\t Cannot compute skew kinematic matrix"
702 "v has not 3 rows")) ;
707 M[0][0] = 0 ; M[0][1] = -v[2] ; M[0][2] = v[1] ;
708 M[1][0] = v[2] ; M[1][1] = 0 ; M[1][2] = -v[0] ;
709 M[2][0] = -v[1] ; M[2][1] = v[0] ; M[2][2] = 0 ;
727 "a has not 3 rows") ;
729 "\n\t\t Cannot compute cross product"
730 "a has not 3 rows")) ;
736 "b has not 3 rows") ;
738 "\n\t\t Cannot compute cross product"
739 "b has not 3 rows")) ;;
765 if(
dsize!=nrows*ncols)
767 vpERROR_TRACE(
"\n\t\t vpColVector mismatch size for reshape vpSubColVector in a vpMatrix") ;
769 "\n\t\t \n\t\t vpColVector mismatch size for reshape vpSubColVector in a vpMatrix")) ;
778 std::cout << me << std::endl ;
782 for(
unsigned int j =0; j< ncols; j++)
783 for(
unsigned int i =0; i< nrows; i++)
784 m[i][j]=
data[j*ncols+i];
something is not initialized
Definition of the vpMatrix class.
Class that consider the case of a generic rotation vector (cannot be used as is !) consisting in thre...
void resize(const unsigned int nrows, const unsigned int ncols, const bool nullify=true)
static vpColVector invSort(const vpColVector &v)
reverse sorting of the elements of vector v
static vpColVector sort(const vpColVector &v)
sort the elements of vector v
void stack(const double &b)
void init()
Initialization of the object matrix.
Definition of the row vector class.
vpColVector operator+(const vpColVector &v) const
operator addition of two vectors V = A+v
error that can be emited by ViSP classes.
double sumSquare() const
return sum of the Aij^2 (for all i, for all j)
vpColVector operator-()
operator A = -A
vpMatrix()
Basic constructor.
static double median(const vpColVector &v)
compute the median
vpColVector operator*(const double &x, const vpColVector &B)
multiplication by a scalar Ci = x*Bi
double * data
address of the first element of the data array
double ** rowPtrs
address of the first element of each rows
vpRowVector t() const
transpose of Vector
vpColVector & operator<<(const vpColVector &v)
Copy operator. Allow operation such as A = v.
static double mean(const vpColVector &v)
compute the mean
void reshape(vpMatrix &m, const unsigned int &nrows, const unsigned int &ncols)
Reshape methods.
unsigned int rowNum
number of rows
vpColVector & operator=(const vpColVector &v)
Copy operator. Allow operation such as A = v.
void resize(unsigned int i)
Set the size of the Row vector.
Class that provides a data structure for the column vectors as well as a set of operations on these v...
unsigned int getCols() const
Return the number of columns of the matrix.
static double dotProd(const vpColVector &a, const vpColVector &b)
Dot Product.
error that can be emited by the vpMatrix class and its derivates
vpColVector()
basic constructor
static vpMatrix skew(const vpColVector &v)
static vpColVector crossProd(const vpColVector &a, const vpColVector &b)
normalise the vector
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.
vpColVector & normalize()
normalise the vector
double operator*(const vpColVector &x) const
operator dot product
void resize(const unsigned int i, const bool flagNullify=true)