34 #ifndef VP_ROW_VECTOR_H
35 #define VP_ROW_VECTOR_H
39 #include <visp3/core/vpConfig.h>
40 #include <visp3/core/vpArray2D.h>
41 #include <visp3/core/vpColVector.h>
42 #include <visp3/core/vpMath.h>
43 #include <visp3/core/vpMatrix.h>
139 VP_EXPLICIT
vpRowVector(
const std::vector<double> &v);
140 VP_EXPLICIT
vpRowVector(
const std::vector<float> &v);
141 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
152 if (data !=
nullptr) {
157 if (rowPtrs !=
nullptr) {
166 std::ostream &cppPrint(std::ostream &os,
const std::string &matrixName =
"A",
bool octet =
false)
const;
167 std::ostream &csvPrint(std::ostream &os)
const;
175 double d2r = M_PI / 180.0;
199 if ((c >= colNum) || ((c + rowsize) > colNum)) {
201 "Cannot extract a (1x%d) row vector from a (1x%d) "
202 "row vector starting at index %d",
203 rowsize, colNum, c));
209 double frobeniusNorm()
const;
220 void init(
const vpRowVector &v,
unsigned int c,
unsigned int ncols);
223 std::ostream &maplePrint(std::ostream &os)
const;
224 std::ostream &matlabPrint(std::ostream &os)
const;
230 inline double &
operator[](
unsigned int n) {
return *(data + n); }
232 inline const double &
operator[](
unsigned int n)
const {
return *(data + n); }
240 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
267 int print(std::ostream &s,
unsigned int length,
char const *intro = 0)
const;
274 double r2d = 180.0 / M_PI;
279 void reshape(
vpMatrix &M,
const unsigned int &nrows,
const unsigned int &ncols);
299 void resize(
unsigned int nrows,
unsigned int ncols,
bool flagNullify)
303 "Cannot resize a row vector to a (%dx%d) dimension "
304 "vector that has more than one row",
310 void stack(
double d);
314 double sumSquare()
const;
316 std::vector<double> toStdVector()
const;
324 static double stdev(
const vpRowVector &v,
bool useBesselCorrection =
false);
326 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
335 VP_DEPRECATED
void init() { }
339 VP_DEPRECATED
void stackMatrices(
const vpRowVector &r) { stack(r); }
357 VP_DEPRECATED
void setIdentity(
const double &val = 1.0);
358 VP_DEPRECATED
double euclideanNorm()
const;
Implementation of a generic 2D array used as base class for matrices and vectors.
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)
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
void reshape(unsigned int nrows, unsigned int ncols)
bool operator==(const vpArray2D< Type > &A) const
Implementation of column vector and the associated operations.
vpColVector operator*(const double &x, const vpColVector &v)
error that can be emitted by ViSP classes.
Implementation of a matrix and operations on matrices.
Implementation of row vector and the associated operations.
vpRowVector(const vpRowVector &v)
vpRowVector(unsigned int n, double val)
Construct a row vector of size n. Each element is set to val.
double & operator[](unsigned int n)
Operator that allows to set a value of an element : v[i] = x.
void resize(unsigned int i, bool flagNullify=true)
vpRowVector()
Basic constructor that creates an empty 0-size row vector.
VP_EXPLICIT vpRowVector(const std::initializer_list< double > &list)
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify)
VP_EXPLICIT vpRowVector(unsigned int n)
const double & operator[](unsigned int n) const
Operator that allows to get the value of an element : x = v[i].
vpRowVector extract(unsigned int c, unsigned int rowsize) const
vpMatrix operator*(const double &x, const vpMatrix &A)