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++)
190 vpTRACE(
" m should be a 1 cols matrix ") ;
222 unsigned int k = v.
rowNum ;
263 for (
unsigned int i=0; i<
rowNum; i++) {
264 for (
unsigned int j=0; j<
colNum; j++) {
274 for (
unsigned int i=0; i<
rowNum; i++) {
275 for (
unsigned int j=0; j<
colNum; j++) {
287 for (
unsigned int i=0;i<
rowNum;i++)
368 double *ad = a.
data ;
double *bd = b.
data ;
371 for (
unsigned int i=0 ; i < a.
getRows() ; i++)
372 c += *(ad++)* *(bd++) ;
408 if (std::fabs(sum) > std::numeric_limits<double>::epsilon())
427 unsigned int nb_permutation = 1 ;
429 while (nb_permutation !=0 )
432 for (
unsigned int j = v.
getRows()-1 ; j >= i+1 ; j--)
434 if ((tab[j]>tab[j-1]))
436 double tmp = tab[j] ;
457 unsigned int nb_permutation = 1 ;
459 while (nb_permutation !=0 )
462 for (
unsigned int j = v.
getRows()-1 ; j >= i+1 ; j--)
464 if ((tab[j]<tab[j-1]))
466 double tmp = tab[j] ;
567 unsigned int nrA = A.
getRows();
568 unsigned int nrB = B.
getRows();
570 if (nrA == 0 && nrB == 0) {
588 for (
unsigned int i=0; i<nrA; i++)
591 for (
unsigned int i=0; i<nrB; i++)
606 double *vd = v.
data ;
607 for (
unsigned int i=0 ; i < v.
getRows() ; i++)
634 unsigned int inf, sup;
648 if (v[i] <= v[j]) inf++;
649 if (v[i] >= v[j]) sup++;
656 infsup[i] = fabs((
double)(inf-sup));
660 unsigned int imin=0 ;
697 "v has not 3 rows") ;
699 "\n\t\t Cannot compute skew kinematic matrix"
700 "v has not 3 rows")) ;
705 M[0][0] = 0 ; M[0][1] = -v[2] ; M[0][2] = v[1] ;
706 M[1][0] = v[2] ; M[1][1] = 0 ; M[1][2] = -v[0] ;
707 M[2][0] = -v[1] ; M[2][1] = v[0] ; M[2][2] = 0 ;
725 "a has not 3 rows") ;
727 "\n\t\t Cannot compute cross product"
728 "a has not 3 rows")) ;
734 "b has not 3 rows") ;
736 "\n\t\t Cannot compute cross product"
737 "b has not 3 rows")) ;;
763 if(
dsize!=nrows*ncols)
765 vpERROR_TRACE(
"\n\t\t vpColVector mismatch size for reshape vpSubColVector in a vpMatrix") ;
767 "\n\t\t \n\t\t vpColVector mismatch size for reshape vpSubColVector in a vpMatrix")) ;
776 std::cout << me << std::endl ;
780 for(
unsigned int j =0; j< ncols; j++)
781 for(
unsigned int i =0; i< nrows; i++)
782 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)
vpMatrix()
Basic constructor.
vpColVector operator-() const
operator A = -A
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)