34#ifndef _vpColVector_h_
35#define _vpColVector_h_
37#include <visp3/core/vpArray2D.h>
38#include <visp3/core/vpMath.h>
39#include <visp3/core/vpPoseVector.h>
40#include <visp3/core/vpRotationVector.h>
41#include <visp3/core/vpRowVector.h>
195#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
197 vpColVector(
const std::initializer_list<double> &list) :
vpArray2D<double>(static_cast<unsigned int>(list.size()), 1)
199 std::copy(list.begin(), list.end(), data);
218 if (rowPtrs != NULL) {
222 rowNum = colNum = dsize = 0;
225 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
226 std::ostream &csvPrint(std::ostream &os)
const;
235 double d2r = M_PI / 180.0;
259 if (r >= rowNum || r + colsize > rowNum) {
261 "Cannot extract a (%dx1) column vector from a (%dx1) "
262 "column vector starting at index %d",
263 colsize, rowNum, r));
269 double frobeniusNorm()
const;
272 double infinityNorm()
const;
273 void init(
const vpColVector &v,
unsigned int r,
unsigned int nrows);
277 std::ostream &maplePrint(std::ostream &os)
const;
278 std::ostream &matlabPrint(std::ostream &os)
const;
284 inline double &
operator[](
unsigned int n) {
return *(data + n); }
286 inline const double &
operator[](
unsigned int n)
const {
return *(data + n); }
296#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
327 int print(std::ostream &s,
unsigned int length,
char const *intro = 0)
const;
336 double r2d = 180.0 / M_PI;
342 void reshape(
vpMatrix &M,
const unsigned int &nrows,
const unsigned int &ncols);
362 void resize(
unsigned int nrows,
unsigned int ncols,
bool flagNullify)
366 "Cannot resize a column vector to a (%dx%d) "
367 "dimension vector that has more than one column",
373 void stack(
double d);
377 double sumSquare()
const;
379 std::vector<double> toStdVector()
const;
406 static double stdev(
const vpColVector &v,
bool useBesselCorrection =
false);
408#ifdef VISP_HAVE_NLOHMANN_JSON
413#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
428 return vpColVector(*
this, first_row - 1, last_row - first_row + 1);
452 vp_deprecated
void insert(
const vpColVector &v,
unsigned int r,
unsigned int c = 0);
453 vp_deprecated
double euclideanNorm()
const;
458#ifndef DOXYGEN_SHOULD_SKIP_THIS
463#ifdef VISP_HAVE_NLOHMANN_JSON
468 j[
"type"] =
"vpColVector";
Implementation of a generic 2D array used as base class for matrices and vectors.
unsigned int getCols() const
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
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)
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
friend void to_json(nlohmann::json &j, const vpArray2D< T > &array)
vpArray2D< Type > t() const
Compute the transpose of the array.
bool operator!=(const vpArray2D< Type > &A) const
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)
bool operator==(const vpArray2D< Type > &A) const
Implementation of column vector and the associated operations.
const double & operator[](unsigned int n) const
Operator that allows to get the value of an element : x = v[i].
vpColVector extract(unsigned int r, unsigned int colsize) const
vpColVector(unsigned int n, double val)
Construct a column vector of size n. Each element is set to val.
vpColVector(unsigned int n)
static vp_deprecated vpColVector stackMatrices(const vpColVector &A, const vpColVector &B)
static vp_deprecated void stackMatrices(const vpColVector &A, const vpColVector &B, vpColVector &C)
double & operator[](unsigned int n)
Operator that allows to set a value of an element : v[i] = x.
vpColVector(const vpColVector &v)
vp_deprecated void init()
vpColVector()
Basic constructor that creates an empty 0-size column vector.
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify)
vp_deprecated void setIdentity(const double &val=1.0)
vp_deprecated vpColVector rows(unsigned int first_row, unsigned int last_row) const
vpColVector(const std::initializer_list< double > &list)
static vpColVector cross(const vpColVector &a, const vpColVector &b)
vp_deprecated void stackMatrices(const vpColVector &r)
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.
vpMatrix operator*(const vpMatrix &B) 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.
vpColVector operator*(const double &x, const vpColVector &v)