40 #ifndef VP_COLVECTOR_H
41 #define VP_COLVECTOR_H
43 #include <visp3/core/vpConfig.h>
45 #ifdef VISP_HAVE_NLOHMANN_JSON
46 #include VISP_NLOHMANN_JSON(json.hpp)
56 #include <visp3/core/vpArray2D.h>
57 #include <visp3/core/vpMath.h>
58 #include <visp3/core/vpPoseVector.h>
59 #include <visp3/core/vpRotationVector.h>
60 #include <visp3/core/vpRowVector.h>
265 VP_EXPLICIT
vpColVector(
const std::vector<double> &v);
270 VP_EXPLICIT
vpColVector(
const std::vector<float> &v);
272 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
279 #if ((__cplusplus >= 201103L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L)))
280 vpColVector(
const std::initializer_list<double> &list) :
vpArray2D<double>(static_cast<unsigned int>(list.
size()), 1)
282 std::copy(list.begin(), list.end(),
data);
292 if (
data !=
nullptr) {
340 std::ostream &
cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
372 std::ostream &
csvPrint(std::ostream &os)
const;
382 double d2r = M_PI / 180.0;
409 "Cannot extract a (%dx1) column vector from a (%dx1) "
410 "column vector starting at index %d",
561 std::ostream &
maplePrint(std::ostream &os)
const;
689 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
1045 int print(std::ostream &s,
unsigned int length,
char const *intro = 0)
const;
1055 double r2d = 180.0 / M_PI;
1121 void reshape(
vpMatrix &M,
const unsigned int &nrows,
const unsigned int &ncols);
1143 void resize(
unsigned int i,
bool flagNullify =
true)
1159 void resize(
unsigned int nrows,
unsigned int ncols,
bool flagNullify)
1163 "Cannot resize a column vector to a (%dx%d) "
1164 "dimension vector that has more than one column",
1185 void stack(
double d);
1232 std::vector<double> toStdVector()
const;
1421 static double stdev(
const vpColVector &v,
bool useBesselCorrection =
false);
1423 #ifdef VISP_HAVE_NLOHMANN_JSON
1441 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
1450 VP_DEPRECATED
void init() { }
1496 VP_DEPRECATED
vpColVector rows(
unsigned int first_row,
unsigned int last_row)
const
1498 return vpColVector(*
this, first_row - 1, last_row - first_row + 1);
1532 VP_DEPRECATED
void insert(
const vpColVector &v,
unsigned int r,
unsigned int c = 0);
1543 VP_DEPRECATED
double euclideanNorm()
const;
1552 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1558 #ifdef VISP_HAVE_NLOHMANN_JSON
1563 j[
"type"] =
"vpColVector";
Implementation of a generic 2D array used as base class for matrices and vectors.
unsigned int getCols() const
double * data
Address of the first element of the data array.
double ** rowPtrs
Address of the first element of each rows.
void insert(const vpArray2D< Type > &A, unsigned int r, unsigned int c)
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
unsigned int rowNum
Number of rows in the array.
friend void to_json(nlohmann::json &j, const vpArray2D< T > &array)
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
unsigned int dsize
Current array size (rowNum * colNum)
unsigned int size() const
Return the number of elements of the 2D array.
vpArray2D< Type > t() const
Compute the transpose of the array.
bool operator!=(const vpArray2D< Type > &A) const
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
vpArray2D< Type > hadamard(const vpArray2D< Type > &m) const
friend void from_json(const nlohmann::json &j, vpArray2D< T > &array)
void reshape(unsigned int nrows, unsigned int ncols)
unsigned int colNum
Number of columns in the array.
bool operator==(const vpArray2D< Type > &A) const
Implementation of column vector and the associated operations.
vpColVector extract(unsigned int r, unsigned int colsize) const
vpColVector(unsigned int n, double val)
VP_EXPLICIT vpColVector(unsigned int n)
double & operator[](unsigned int n)
vpColVector(const vpColVector &v)
const double & operator[](unsigned int n) const
vpColVector operator*(const double &x, const vpColVector &v)
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify)
static vpColVector cross(const vpColVector &a, const vpColVector &b)
void resize(unsigned int i, bool flagNullify=true)
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of a matrix and operations on matrices.
std::ostream & cppPrint(std::ostream &os, const std::string &matrixName="A", bool octet=false) const
vpMatrix operator-() const
vpMatrix & operator/=(double x)
Divide all the element of the matrix by x : Aij = Aij / x.
int print(std::ostream &s, unsigned int length, const std::string &intro="") const
std::ostream & maplePrint(std::ostream &os) const
void init(const vpMatrix &M, unsigned int r, unsigned int c, unsigned int nrows, unsigned int ncols)
vpMatrix operator*(const vpMatrix &B) const
vpMatrix operator/(double x) const
Cij = Aij / x (A is unchanged)
void stack(const vpMatrix &A)
vpMatrix & operator-=(const vpMatrix &B)
Operation A = A - B.
vpMatrix & operator*=(double x)
Multiply all the element of the matrix by x : Aij = Aij * x.
vpMatrix operator+(const vpMatrix &B) const
vpMatrix & operator+=(const vpMatrix &B)
Operation A = A + B.
double infinityNorm() const
double frobeniusNorm() const
vpMatrix & operator,(double val)
vpMatrix transpose() const
std::ostream & csvPrint(std::ostream &os) const
std::ostream & matlabPrint(std::ostream &os) const
Implementation of a pose vector and operations on poses.
Implementation of a generic rotation vector.
Implementation of row vector and the associated operations.
Class that consider the case of a translation vector.