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>
69 "Bad size during vpColVector (%dx1) and vpColVector (%dx1) addition",
74 for (
unsigned int i=0;i<
rowNum;i++)
75 v[i] = (*
this)[i] + m[i];
85 for (
unsigned int i=0;i<
rowNum;i++)
86 v += (*
this)[i] * m[i];
102 "Bad size during vpColVector (%dx1) and vpColVector (%dx1) substraction",
107 for (
unsigned int i=0;i<
rowNum;i++)
108 v[i] = (*
this)[i] - m[i];
118 "\n\t\t SubvpMatrix larger than vpColVector")) ;
120 init(m, r, 0, nrows, 1);
143 double *vd = A.
data ;
double *d =
data ;
145 for (
unsigned int i=0; i<
rowNum; i++)
164 double *vd = v.
data ;
double *d =
data ;
166 for (
unsigned int i=0;i<
rowNum;i++)
179 vpTRACE(
" m should be a 1 cols matrix ") ;
211 unsigned int k = v.
rowNum ;
302 for (
unsigned int i=0; i<
rowNum; i++) {
303 for (
unsigned int j=0; j<
colNum; j++) {
315 for (
unsigned int i=0;i<
rowNum;i++)
396 double *ad = a.
data ;
double *bd = b.
data ;
399 for (
unsigned int i=0 ; i < a.
getRows() ; i++)
400 c += *(ad++)* *(bd++) ;
436 if (std::fabs(sum_square) > std::numeric_limits<double>::epsilon())
437 *
this /= sqrt(sum_square) ;
455 unsigned int nb_permutation = 1 ;
457 while (nb_permutation !=0 )
460 for (
unsigned int j = v.
getRows()-1 ; j >= i+1 ; j--)
462 if ((tab[j]>tab[j-1]))
464 double tmp = tab[j] ;
485 unsigned int nb_permutation = 1 ;
487 while (nb_permutation !=0 )
490 for (
unsigned int j = v.
getRows()-1 ; j >= i+1 ; j--)
492 if ((tab[j]<tab[j-1]))
494 double tmp = tab[j] ;
595 unsigned int nrA = A.
getRows();
596 unsigned int nrB = B.
getRows();
598 if (nrA == 0 && nrB == 0) {
616 for (
unsigned int i=0; i<nrA; i++)
619 for (
unsigned int i=0; i<nrB; i++)
634 double *vd = v.
data ;
635 for (
unsigned int i=0 ; i < v.
getRows() ; i++)
662 unsigned int inf, sup;
676 if (v[i] <= v[j]) inf++;
677 if (v[i] >= v[j]) sup++;
684 infsup[i] = fabs((
double)(inf-sup));
688 unsigned int imin=0 ;
725 "v has not 3 rows") ;
727 "\n\t\t Cannot compute skew kinematic matrix"
728 "v has not 3 rows")) ;
733 M[0][0] = 0 ; M[0][1] = -v[2] ; M[0][2] = v[1] ;
734 M[1][0] = v[2] ; M[1][1] = 0 ; M[1][2] = -v[0] ;
735 M[2][0] = -v[1] ; M[2][1] = v[0] ; M[2][2] = 0 ;
753 "a has not 3 rows") ;
755 "\n\t\t Cannot compute cross product"
756 "a has not 3 rows")) ;
762 "b has not 3 rows") ;
764 "\n\t\t Cannot compute cross product"
765 "b has not 3 rows")) ;;
791 if(
dsize!=nrows*ncols)
793 vpERROR_TRACE(
"\n\t\t vpColVector mismatch size for reshape vpSubColVector in a vpMatrix") ;
795 "\n\t\t \n\t\t vpColVector mismatch size for reshape vpSubColVector in a vpMatrix")) ;
804 std::cout << me << std::endl ;
808 for(
unsigned int j =0; j< ncols; j++)
809 for(
unsigned int i =0; i< nrows; i++)
810 m[i][j]=
data[j*ncols+i];
861 for (
unsigned int j=0; j < v.
size(); j++)
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
Addition of two vectors V = A+v.
error that can be emited by ViSP classes.
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
unsigned int size() const
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 a vector.
vpColVector & operator<<(const vpColVector &v)
static double mean(const vpColVector &v)
compute the mean
void reshape(vpMatrix &m, const unsigned int &nrows, const unsigned int &ncols)
Reshape methods.
void resize(const unsigned int i, const bool flagNullify=true)
void insert(unsigned int i, const vpColVector &v)
unsigned int rowNum
number of rows
vpColVector & operator=(const vpColVector &v)
Copy operator. Allow operation such as A = v.
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)
Compute the cross product of two vectors C = a x b.
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
Dot product.
void resize(const unsigned int i, const bool flagNullify=true)