RowVector

class RowVector(*args, **kwargs)

Bases: ArrayDouble2D

Implementation of row vector and the associated operations.

This class provides a data structure for a row vector that contains values of double. It contains also some functions to achieve a set of operations on these vectors.

The vpRowVector class is derived from vpArray2D<double> .

The code below shows how to create a 3-element row vector of doubles, set the element values and access them:

#include <visp3/code/vpRowVector.h

int main()
{
  vpRowVector v(3);
  v[0] = -1; v[1] = -2.1; v[2] = -3;

  std::cout << "v:" << std::endl;
  for (unsigned int i = 0; i < v.size(); ++i) {
    std::cout << v[i] << " ";
  }
  std::cout << std::endl;
}

Once build, this previous code produces the following output:

v:
-1 -2.1 -3

If ViSP is build with c++11 enabled, you can do the same using:

#include <visp3/code/vpRowVector.h

int main()
{
  vpRowVector v{-1, -2.1, -3};
  std::cout << "v:\n" << v << std::endl;
}

The vector could also be initialized using operator=(const std::initializer_list< double > &)

int main()
{
  vpRowVector v;
  v = {-1, -2.1, -3};
}

Overloaded function.

  1. __init__(self: visp._visp.core.RowVector) -> None

Basic constructor that creates an empty 0-size row vector.

  1. __init__(self: visp._visp.core.RowVector, n: int) -> None

Construct a row vector of size n. All the elements are initialized to zero.

  1. __init__(self: visp._visp.core.RowVector, n: int, val: float) -> None

Construct a row vector of size n. Each element is set to val .

  1. __init__(self: visp._visp.core.RowVector, v: visp._visp.core.RowVector) -> None

Copy constructor that allows to construct a row vector from an other one.

  1. __init__(self: visp._visp.core.RowVector, v: visp._visp.core.RowVector, c: int, ncols: int) -> None

Construct a row vector from a part of an input row vector v .

The sub-vector starting from v[c] element and ending on v[c+ncols-1] element is used to initialize the constructed row vector.

Note

See init()

Parameters:
v

Input row vector used for initialization.

c

column index in v that corresponds to the first element of the row vector to construct.

ncols

Number of columns of the constructed row vector.

  1. __init__(self: visp._visp.core.RowVector, M: visp._visp.core.Matrix) -> None

Constructor that creates a row vector from a 1-by-n matrix M .

  1. __init__(self: visp._visp.core.RowVector, M: visp._visp.core.Matrix, i: int) -> None

Constructor that creates a row vector corresponding to row i of matrix M .

  1. __init__(self: visp._visp.core.RowVector, v: list[float]) -> None

Constructor that creates a row vector from a std vector of double.

  1. __init__(self: visp._visp.core.RowVector, v: list[float]) -> None

Constructor that creates a row vector from a std vector of float.

  1. __init__(self: visp._visp.core.RowVector, list: std::initializer_list<double>) -> None

  2. __init__(self: visp._visp.core.RowVector, np_array: numpy.ndarray[numpy.float64]) -> None

Construct a row vector by copying a 1D numpy array.

Parameters:
np_array

The numpy 1D array to copy.

Methods

__init__

Overloaded function.

clear

Removes all elements from the vector (which are destroyed), leaving the container with a size of 0.

deg2rad

Convert a column vector containing angles in degrees into radians.

extract

Extract a sub-row vector from a row vector.

frobeniusNorm

Compute and return the Frobenius norm \(||v|| = \sqrt{ \sum{v_{i}^2}}\) .

init

Initialize the row vector from a part of an input row vector v .

insert

Overloaded function.

mean

Compute the mean value of all the elements of the vector.

median

Compute the median value of all the elements of the vector.

normalize

Overloaded function.

numpy

Numpy view of the underlying array data.

print

Pretty print a row vector.

rad2deg

Convert a column vector containing angles in radians into degrees.

reshape

Overloaded function.

resize

Overloaded function.

stack

Overloaded function.

stackVectors

Overloaded function.

stdev

Compute the standard deviation value of all the elements of the vector.

strCppCode

Returns a C++ code representation of this data array (see cppPrint in the C++ documentation)

strCsv

Returns the CSV representation of this data array (see csvPrint in the C++ documentation)

strMaple

Returns the CSV representation of this data array (see maplePrint in the C++ documentation)

strMatlab

Returns the Matlab representation of this data array (see matlabPrint in the C++ documentation)

sum

Return the sum of all the elements \(v_{i}\) of the row vector v(n).

sumSquare

Return the sum square of all the elements \(v_{i}\) of the row vector v(n).

t

Overloaded function.

toStdVector

return:

The corresponding std::vector<double>.

transpose

Overloaded function.

Inherited Methods

getCols

Return the number of columns of the 2D array.

insertStatic

Insert array B in array A at the given position.

save

Overloaded function.

getRows

Return the number of rows of the 2D array.

size

Return the number of elements of the 2D array.

getMinValue

Return the array min value.

getMaxValue

Return the array max value.

hadamard

param m:

Second matrix;

saveYAML

Save an array in a YAML-formatted file.

conv2

Overloaded function.

Operators

__add__

Operator that allows to add to row vectors that have the same size.

__doc__

__eq__

Comparison operator.

__getitem__

Overloaded function.

__hash__

__iadd__

Operator that allows to add two row vectors that have the same size.

__imul__

Operator that allows to multiply each element of a row vector by a scalar.

__init__

Overloaded function.

__isub__

Operator that allows to subtract two row vectors that have the same size.

__itruediv__

Operator that allows to divide each element of a row vector by a scalar.

__module__

__mul__

Overloaded function.

__ne__

__neg__

Operator that allows to negate all the row vector elements.

__sub__

Operator that allows to subtract to row vectors that have the same size.

__truediv__

Operator that allows to divide each element of a row vector by a scalar.

Attributes

__annotations__

__hash__

__add__(self, v: visp._visp.core.RowVector) visp._visp.core.RowVector

Operator that allows to add to row vectors that have the same size.

__eq__(self, v: visp._visp.core.RowVector) bool

Comparison operator.

__getitem__(*args, **kwargs)

Overloaded function.

  1. __getitem__(self: visp._visp.core.RowVector, arg0: int) -> float

  2. __getitem__(self: visp._visp.core.RowVector, arg0: slice) -> numpy.ndarray[numpy.float64]

__iadd__(self, v: visp._visp.core.RowVector) visp._visp.core.RowVector

Operator that allows to add two row vectors that have the same size.

__imul__(self, x: float) visp._visp.core.RowVector

Operator that allows to multiply each element of a row vector by a scalar.

vpRowVector v(3);
v[0] = 1;
v[1] = 2;
v[2] = 3;

v *= 3;
// v is now equal to : [3 6 9]
Parameters:
x: float

The scalar.

Returns:

The row vector multiplied by the scalar.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.core.RowVector) -> None

Basic constructor that creates an empty 0-size row vector.

  1. __init__(self: visp._visp.core.RowVector, n: int) -> None

Construct a row vector of size n. All the elements are initialized to zero.

  1. __init__(self: visp._visp.core.RowVector, n: int, val: float) -> None

Construct a row vector of size n. Each element is set to val .

  1. __init__(self: visp._visp.core.RowVector, v: visp._visp.core.RowVector) -> None

Copy constructor that allows to construct a row vector from an other one.

  1. __init__(self: visp._visp.core.RowVector, v: visp._visp.core.RowVector, c: int, ncols: int) -> None

Construct a row vector from a part of an input row vector v .

The sub-vector starting from v[c] element and ending on v[c+ncols-1] element is used to initialize the constructed row vector.

Note

See init()

Parameters:
v

Input row vector used for initialization.

c

column index in v that corresponds to the first element of the row vector to construct.

ncols

Number of columns of the constructed row vector.

  1. __init__(self: visp._visp.core.RowVector, M: visp._visp.core.Matrix) -> None

Constructor that creates a row vector from a 1-by-n matrix M .

  1. __init__(self: visp._visp.core.RowVector, M: visp._visp.core.Matrix, i: int) -> None

Constructor that creates a row vector corresponding to row i of matrix M .

  1. __init__(self: visp._visp.core.RowVector, v: list[float]) -> None

Constructor that creates a row vector from a std vector of double.

  1. __init__(self: visp._visp.core.RowVector, v: list[float]) -> None

Constructor that creates a row vector from a std vector of float.

  1. __init__(self: visp._visp.core.RowVector, list: std::initializer_list<double>) -> None

  2. __init__(self: visp._visp.core.RowVector, np_array: numpy.ndarray[numpy.float64]) -> None

Construct a row vector by copying a 1D numpy array.

Parameters:
np_array

The numpy 1D array to copy.

__isub__(self, v: visp._visp.core.RowVector) visp._visp.core.RowVector

Operator that allows to subtract two row vectors that have the same size.

__itruediv__(self, x: float) visp._visp.core.RowVector

Operator that allows to divide each element of a row vector by a scalar.

vpRowVector v(3);
v[0] = 8;
v[1] = 4;
v[2] = 2;
// v is equal to : [8 4 2]

v /= 2;
// v is equal to : [4 2 1]
Parameters:
x: float

The scalar.

Returns:

The row vector divided by the scalar.

__mul__(*args, **kwargs)

Overloaded function.

  1. __mul__(self: visp._visp.core.RowVector, x: visp._visp.core.ColVector) -> float

Multiply a row vector by a column vector.

Parameters:
x

Column vector.

Returns:

A scalar.

  1. __mul__(self: visp._visp.core.RowVector, M: visp._visp.core.Matrix) -> visp._visp.core.RowVector

Multiply a row vector by a matrix.

Parameters:
M

Matrix.

Returns:

The resulting row vector.

  1. __mul__(self: visp._visp.core.RowVector, x: float) -> visp._visp.core.RowVector

Operator that allows to multiply each element of a row vector by a scalar.

vpRowVector v(3);
v[0] = 1;
v[1] = 2;
v[2] = 3;

vpRowVector w = v * 3;
// v is unchanged
// w is now equal to : [3 6 9]
Parameters:
x

The scalar.

Returns:

The row vector multiplied by the scalar. The current row vector (*this) is unchanged.

__ne__(self, v: visp._visp.core.RowVector) bool
__neg__(self) visp._visp.core.RowVector

Operator that allows to negate all the row vector elements.

vpRowVector r(3, 1);
// r contains [1 1 1]
vpRowVector v = -r;
// v contains [-1 -1 -1]
__sub__(self, v: visp._visp.core.RowVector) visp._visp.core.RowVector

Operator that allows to subtract to row vectors that have the same size.

__truediv__(self, x: float) visp._visp.core.RowVector

Operator that allows to divide each element of a row vector by a scalar.

vpRowVector v(3);
v[0] = 8;
v[1] = 4;
v[2] = 2;

vpRowVector w = v / 2;
// v is equal to : [8 4 2]
// w is equal to : [4 2 1]
Parameters:
x: float

The scalar.

Returns:

The row vector divided by the scalar. The current row vector (*this) is unchanged.

clear(self) None

Removes all elements from the vector (which are destroyed), leaving the container with a size of 0.

static conv2(*args, **kwargs)

Overloaded function.

  1. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D

Perform a 2D convolution similar to Matlab conv2 function: \(M \star kernel\) .

<unparsed image <doxmlparser.compound.docImageType object at 0x7ff6a36292a0>>

Note

This is a very basic implementation that does not use FFT.

Parameters:
M

First matrix.

kernel

Second matrix.

mode

Convolution mode: “full” (default), “same”, “valid”.

  1. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None

Perform a 2D convolution similar to Matlab conv2 function: \(M \star kernel\) .

<unparsed image <doxmlparser.compound.docImageType object at 0x7ff6a362aec0>>

Note

This is a very basic implementation that does not use FFT.

Parameters:
M

First array.

kernel

Second array.

res

Result.

mode

Convolution mode: “full” (default), “same”, “valid”.

deg2rad(self) None

Convert a column vector containing angles in degrees into radians.

Note

See rad2deg()

extract(self, c: int, rowsize: int) visp._visp.core.RowVector

Extract a sub-row vector from a row vector.

vpRowVector r1;
for (unsigned int i=0; i<4; ++i)
  r1.stack(i);
// r1 is equal to [0 1 2 3]
vpRowVector r2 = r1.extract(1, 3);
// r2 is equal to [1 2 3]
Parameters:
c: int

Index of the column corresponding to the first element of the vector to extract.

rowsize: int

Size of the vector to extract.

frobeniusNorm(self) float

Compute and return the Frobenius norm \(||v|| = \sqrt{ \sum{v_{i}^2}}\) .

Returns:

The Frobenius norm if the vector is initialized, 0 otherwise.

getCols(self) int

Return the number of columns of the 2D array.

Note

See getRows() , size()

getMaxValue(self) float

Return the array max value.

getMinValue(self) float

Return the array min value.

getRows(self) int

Return the number of rows of the 2D array.

Note

See getCols() , size()

hadamard(self, m: visp._visp.core.ArrayDouble2D) visp._visp.core.ArrayDouble2D
Parameters:
m: visp._visp.core.ArrayDouble2D

Second matrix;

Returns:

m1.hadamard(m2) The Hadamard product : \(m1 \circ m2 = (m1 \circ m2)_{i,j} = (m1)_{i,j} (m2)_{i,j}\)

init(self, v: visp._visp.core.RowVector, c: int, ncols: int) None

Initialize the row vector from a part of an input row vector v .

The sub-vector starting from v[c] element and ending on v[c+ncols-1] element is used to initialize the constructed row vector.

The following code shows how to use this function:

#include <visp3/core/vpRowVector.h>

int main()
{
  vpRowVector v(4);
  int val = 0;
  for(size_t i=0; i<v.getCols(); i++) {
    v[i] = val++;
  }
  std::cout << "v: " << v << std::endl;

  vpRowVector w;
  w.init(v, 1, 2);
  std::cout << "w: " << w << std::endl;
}

It produces the following output:

v: 0 1 2 3
w: 1 2
Parameters:
v: visp._visp.core.RowVector

Input row vector used for initialization.

c: int

column index in v that corresponds to the first element of the row vector to construct.

ncols: int

Number of columns of the constructed row vector.

insert(*args, **kwargs)

Overloaded function.

  1. insert(self: visp._visp.core.RowVector, i: int, v: visp._visp.core.RowVector) -> None

Insert a row vector.The following example shows how to use this function:

#include <visp3/core/vpRowVector.h>

int main()
{
  vpRowVector v(4);
  for (unsigned int i=0; i < v.size(); i++)
    v[i] = i;
  std::cout << "v: " << v << std::endl;

  vpRowVector w(2);
  for (unsigned int i=0; i < w.size(); i++)
    w[i] = i+10;
  std::cout << "w: " << w << std::endl;

  v.insert(1, w);
  std::cout << "v: " << v << std::endl;
}  

It produces the following output:

v: 0  1  2  3
w: 10  11
v: 0  10  11  3
Parameters:
i

Index of the first element to introduce. This index starts from 0.

v

Row vector to insert.

  1. insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, r: int, c: int) -> None

Insert array A at the given position in the current array.

Warning

Throw vpException::dimensionError if the dimensions of the matrices do not allow the operation.

Parameters:
A

The array to insert.

r

The index of the row to begin to insert data.

c

The index of the column to begin to insert data.

  1. insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, B: visp._visp.core.ArrayDouble2D, r: int, c: int) -> visp._visp.core.ArrayDouble2D

Insert array B in array A at the given position.

Warning

Throw exception if the sizes of the arrays do not allow the insertion.

Parameters:
A

Main array.

B

Array to insert.

r

Index of the row where to add the array.

c

Index of the column where to add the array.

Returns:

Array with B insert in A.

static insertStatic(A: visp._visp.core.ArrayDouble2D, B: visp._visp.core.ArrayDouble2D, C: visp._visp.core.ArrayDouble2D, r: int, c: int) None

Insert array B in array A at the given position.

Warning

Throw exception if the sizes of the arrays do not allow the insertion.

Parameters:
A: visp._visp.core.ArrayDouble2D

Main array.

B: visp._visp.core.ArrayDouble2D

Array to insert.

C: visp._visp.core.ArrayDouble2D

Result array.

r: int

Index of the row where to insert array B.

c: int

Index of the column where to insert array B.

static mean(v: visp._visp.core.RowVector) float

Compute the mean value of all the elements of the vector.

static median(v: visp._visp.core.RowVector) float

Compute the median value of all the elements of the vector.

normalize(*args, **kwargs)

Overloaded function.

  1. normalize(self: visp._visp.core.RowVector) -> visp._visp.core.RowVector

Normalise the vector modifying the vector as:

\[{\bf x} = \frac{{\bf x}}{\sqrt{\sum_{i=1}^{n}x^2_i}} \]

where \(x_i\) is an element of the row vector \(\bf x\) .

  1. normalize(self: visp._visp.core.RowVector, x: visp._visp.core.RowVector) -> visp._visp.core.RowVector

Normalize the vector given as input parameter and return the normalized vector:

\[{\bf x} = \frac{{\bf x}}{\sqrt{\sum_{i=1}^{n}x^2_i}} \]

where \(x_i\) is an element of the row vector \(\bf x\) .

numpy(self) numpy.ndarray[numpy.float64]

Numpy view of the underlying array data. This numpy view can be used to directly modify the array.

print(self: visp._visp.core.RowVector, s: std::ostream, length: int, intro: str = 0) int

Pretty print a row vector. The data are tabulated. The common widths before and after the decimal point are set with respect to the parameter maxlen.

Note

See std::ostream & operator<<(std::ostream &s, const vpArray2D<Type> &A)

Parameters:
s

Stream used for the printing.

length

The suggested width of each row vector element. The actual width grows in order to accommodate the whole integral part, and shrinks if the whole extent is not needed for all the numbers.

intro

The introduction which is printed before the vector. Can be set to zero (or omitted), in which case the introduction is not printed.

Returns:

Returns the common total width for all vector elements.

rad2deg(self) None

Convert a column vector containing angles in radians into degrees.

Note

See deg2rad()

reshape(*args, **kwargs)

Overloaded function.

  1. reshape(self: visp._visp.core.RowVector, M: visp._visp.core.Matrix, nrows: int, ncols: int) -> None

Reshape the row vector in a matrix.The following example shows how to use this method.

#include <visp3/core/vpRowVector.h>

int main()
{
  int var=0;
  vpMatrix mat(3, 4);
  for (int i = 0; i < 3; i++)
      for (int j = 0; j < 4; j++)
          mat[i][j] = ++var;
  std::cout << "mat: \n" << mat << std::endl;

  vpRowVector row = mat.stackRows();
  std::cout << "row vector: " << row << std::endl;

  vpMatrix remat = row.reshape(3, 4);
  std::cout << "remat: \n" << remat << std::endl;
}

If you run the previous example, you get:

mat:
1  2  3  4
5  6  7  8
9  10  11  12
row vector: 1  2  3  4  5  6  7  8  9  10  11  12
remat:
1  2  3  4
5  6  7  8
9  10  11  12
Parameters:
M

the reshaped matrix.

nrows

number of rows of the matrix.

ncols

number of columns of the matrix.

  1. reshape(self: visp._visp.core.RowVector, nrows: int, ncols: int) -> visp._visp.core.Matrix

Note

See reshape(vpMatrix &, const unsigned int &, const unsigned int &)

Parameters:
nrows

number of rows of the matrix.

ncols

number of columns of the matrix.

Returns:

The resulting matrix.

  1. reshape(self: visp._visp.core.ArrayDouble2D, nrows: int, ncols: int) -> None

resize(*args, **kwargs)

Overloaded function.

  1. resize(self: visp._visp.core.RowVector, i: int, flagNullify: bool = true) -> None

Modify the size of the row vector.

Parameters:
i

Size of the vector. This value corresponds to the vector number of columns.

flagNullify

If true, set the data to zero.

  1. resize(self: visp._visp.core.RowVector, nrows: int, ncols: int, flagNullify: bool) -> None

Resize the row vector to a ncols-dimension vector. This function can only be used with nrows = 1.

Parameters:
nrows

Vector number of rows. This value should be set to 1.

ncols

Vector number of columns. This value corresponds to the size of the vector.

flagNullify

If true, set the data to zero.

  1. resize(self: visp._visp.core.ArrayDouble2D, nrows: int, ncols: int, flagNullify: bool = true, recopy_: bool = true) -> None

Set the size of the array and initialize all the values to zero.

Parameters:
nrows

number of rows.

ncols

number of column.

flagNullify

if true, then the array is re-initialized to 0 after resize. If false, the initial values from the common part of the array (common part between old and new version of the array) are kept. Default value is true.

recopy_

if true, will perform an explicit recopy of the old data.

static save(*args, **kwargs)

Overloaded function.

  1. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

Save a matrix to a file.

Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.

Note

See load()

Parameters:
filename

Absolute file name.

A

Array to be saved.

binary

If true the matrix is saved in a binary file, else a text file.

header

Optional line that will be saved at the beginning of the file.

Returns:

Returns true if success.

  1. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

Save a matrix to a file.

Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.

Note

See load()

Parameters:
filename

Absolute file name.

A

Array to be saved.

binary

If true the matrix is saved in a binary file, else a text file.

header

Optional line that will be saved at the beginning of the file.

Returns:

Returns true if success.

  1. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

Save a matrix to a file.

Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.

Note

See load()

Parameters:
filename

Absolute file name.

A

Array to be saved.

binary

If true the matrix is saved in a binary file, else a text file.

header

Optional line that will be saved at the beginning of the file.

Returns:

Returns true if success.

static saveYAML(filename: str, A: visp._visp.core.ArrayDouble2D, header: str =) bool

Save an array in a YAML-formatted file.

Here is an example of outputs.

vpArray2D<double> M(3,4);
vpArray2D::saveYAML("matrix.yml", M, "example: a YAML-formatted header");
vpArray2D::saveYAML("matrixIndent.yml", M, "example:\n    - a YAML-formatted \
header\n    - with inner indentation");

Content of matrix.yml:

example: a YAML-formatted header
rows: 3
cols: 4
data:
  - [0, 0, 0, 0]
  - [0, 0, 0, 0]
  - [0, 0, 0, 0]

Content of matrixIndent.yml:

example:
    - a YAML-formatted header
    - with inner indentation
rows: 3
cols: 4
data:
    - [0, 0, 0, 0]
    - [0, 0, 0, 0]
    - [0, 0, 0, 0]

Note

See loadYAML()

Parameters:
filename

absolute file name.

A

array to be saved in the file.

header

optional lines that will be saved at the beginning of the file. Should be YAML-formatted and will adapt to the indentation if any.

Returns:

Returns true if success.

size(self) int

Return the number of elements of the 2D array.

stack(*args, **kwargs)

Overloaded function.

  1. stack(self: visp._visp.core.RowVector, d: float) -> None

Stack row vector with a new element at the end of the vector.

vpRowVector v(3, 1);
// v is equal to [1 1 1]
v.stack(-2);
// v is equal to [1 1 1 -2]

Note

See stack(const vpRowVector &, const vpRowVector &)

Note

See stack(const vpRowVector &, const vpRowVector &, vpRowVector &)

Parameters:
d

Element to stack to the existing one.

  1. stack(self: visp._visp.core.RowVector, v: visp._visp.core.RowVector) -> None

Stack row vectors.

vpRowVector v1(3, 1);
// v1 is equal to [1 1 1]
vpRowVector v2(2, 3);
// v2 is equal to [3 3]
v1.stack(v2);
// v1 is equal to [1 1 1 3 3]

Note

See stack(const vpRowVector &, const double &)

Note

See stack(const vpRowVector &, const vpRowVector &)

Note

See stack(const vpRowVector &, const vpRowVector &, vpRowVector &)

Parameters:
v

Vector to stack to the existing one.

static stackVectors(*args, **kwargs)

Overloaded function.

  1. stackVectors(A: visp._visp.core.RowVector, B: visp._visp.core.RowVector) -> visp._visp.core.RowVector

Stack row vectors.

vpRowVector r1(3, 1);
// r1 is equal to [1 1 1]
vpRowVector r2(2, 3);
// r2 is equal to [3 3]
vpRowVector v;
v = vpRowVector::stack(r1, r2);
// v is equal to [1 1 1 3 3]

Note

See stack(const vpRowVector &)

Note

See stack(const vpRowVector &, const vpRowVector &, vpRowVector &)

Parameters:
A

Initial vector.

B

Vector to stack at the end of A.

Returns:

Stacked vector \([A B]\) .

  1. stackVectors(A: visp._visp.core.RowVector, B: visp._visp.core.RowVector, C: visp._visp.core.RowVector) -> None

Stack row vectors.

vpRowVector r1(3, 1);
// r1 is equal to [1 1 1]
vpRowVector r2(2, 3);
// r2 is equal to [3 3]
vpRowVector v;
vpRowVector::stack(r1, r2, v);
// v is equal to [1 1 1 3 3]

Note

See stack(const vpRowVector &)

Note

See stack(const vpRowVector &, const vpRowVector &)

Parameters:
A

Initial vector.

B

Vector to stack at the end of A.

C

Resulting stacked vector \(C = [A B]\) .

static stdev(v: visp._visp.core.RowVector, useBesselCorrection: bool = false) float

Compute the standard deviation value of all the elements of the vector.

strCppCode(self, name: str, byte_per_byte: bool = False) str

Returns a C++ code representation of this data array (see cppPrint in the C++ documentation)

Parameters:
name: str

variable name of the matrix.

byte_per_byte: bool = False

Whether to print byte per byte defaults to false.

strCsv(self) str

Returns the CSV representation of this data array (see csvPrint in the C++ documentation)

strMaple(self) str

Returns the CSV representation of this data array (see maplePrint in the C++ documentation)

strMatlab(self) str

Returns the Matlab representation of this data array (see matlabPrint in the C++ documentation)

sum(self) float

Return the sum of all the elements \(v_{i}\) of the row vector v(n).

Returns:

The sum square value: \(\sum_{j=0}^{n} v_j\) .

sumSquare(self) float

Return the sum square of all the elements \(v_{i}\) of the row vector v(n).

Returns:

The sum square value: \(\sum_{j=0}^{n} v_j^{2}\) .

t(*args, **kwargs)

Overloaded function.

  1. t(self: visp._visp.core.RowVector) -> visp._visp.core.ColVector

Transpose the row vector. The resulting vector becomes a column vector.

  1. t(self: visp._visp.core.ArrayDouble2D) -> visp._visp.core.ArrayDouble2D

Compute the transpose of the array.

Returns:

vpArray2D<Type> C = A^T

toStdVector(self) list[float]
Returns:

The corresponding std::vector<double>.

transpose(*args, **kwargs)

Overloaded function.

  1. transpose(self: visp._visp.core.RowVector) -> visp._visp.core.ColVector

Transpose the row vector. The resulting vector becomes a column vector.

Note

See t()

  1. transpose(self: visp._visp.core.RowVector, v: visp._visp.core.ColVector) -> None

Transpose the row vector. The resulting vector v becomes a column vector.

Note

See t()

__hash__ = None