ForceTwistMatrix

class ForceTwistMatrix(*args, **kwargs)

Bases: ArrayDouble2D

This class derived from vpArray2D<double> implements the 6 by 6 matrix which transforms force/torque from one frame to another. This matrix is also called force/torque twist transformation matrix.

The full force/torque twist transformation matrix allows to compute the force/torque at point a expressed in frame a knowing its force/torque at point b expressed in frame b . This matrix is defined as:

\[\begin{split}^a{\bf F}_b = \left[ \begin{array}{cc} ^a{\bf R}_b & {\bf 0}_{3\times 3}\\{[^a{\bf t}_b]}_{\times} \; ^a{\bf R}_b & ^a{\bf R}_b \end{array} \right] \end{split}\]

where \(^a{\bf R}_b\) is a rotation matrix and \(^a{\bf t}_b\) is a translation vector.

There are different ways to initialize such a full force/torque twist matrix. The following example shows how to proceed setting the translation and rotation matrix transformations:

#include <visp3/core/vpForceTwistMatrix.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpTranslationVector stp(0.1, 0.2, 0.3);
  vpRotationMatrix sRp( {0,  0, -1,
                        0, -1,  0,
                        -1,  0,  0} );
  vpForceTwistMatrix sFp(stp, sRp);
  std::cout << "sFp:\n" << sFp << std::endl;
}

It produces the following printings:

sFp:
0  0  -1  0  0  0
0  -1  0  0  0  0
-1  0  0  0  0  0
-0.2  0.3  0  0  0  -1
0.1  0  -0.3  0  -1  0
0  -0.1  0.2  -1  0  0

When the point where the velocity is expressed doesn’t change, the matrix becomes block diagonal. It allows than to compute the force/torque at point b expressed in frame a knowing its force/torque at point b expressed in frame b :

\[\begin{split}^a{\bf F}_b = \left[ \begin{array}{cc} ^a{\bf R}_b & {\bf 0}_{3\times 3}\\{\bf 0}_{3\times 3} & ^a{\bf R}_b \end{array} \right] \end{split}\]

To initialize such a force/torque twist matrix where translation is not taken into account you can proceed like in the following code:

#include <visp3/core/vpForceTwistMatrix.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpRotationMatrix sRp( {0,  0, -1,
                        0, -1,  0,
                        -1,  0,  0} );
  vpForceTwistMatrix sFp(sRp);
  std::cout << "sFp:\n" << sFp << std::endl;
}

It produces the following printings:

sFp:
0  0  -1  0  0  0
0  -1  0  0  0  0
-1  0  0  0  0  0
0  0  0  0  0  -1
0  0  0  0  -1  0
0  0  0  -1  0  0

The code belows shows for example how to convert a force/torque skew from probe frame to a sensor frame.

#include <visp3/core/vpColVector.h>
#include <visp3/core/vpForceTwistMatrix.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  // Twist transformation matrix from sensor to probe frame
  vpForceTwistMatrix sFp;

  // Force/torque sensor frame to probe frame transformation
  vpHomogeneousMatrix sMp;
  // ... sMp need here to be initialized

  sFp.buildFrom(sMp);

  // Force/torque skew in the probe frame: fx,fy,fz,tx,ty,tz
  vpColVector p_H(6);
  // ... p_H should here have an initial value

  // Force/torque skew in the sensor frame: fx,fy,fz,tx,ty,tz
  vpColVector s_H(6);

  // Compute the value of the force/torque in the sensor frame
  s_H = sFp * p_H;
}

Overloaded function.

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

Initialize a force/torque twist transformation matrix to identity.

  1. __init__(self: visp._visp.core.ForceTwistMatrix, F: visp._visp.core.ForceTwistMatrix) -> None

Initialize a force/torque twist transformation matrix from another force/torque twist matrix.

Parameters:
F

Force/torque twist matrix used as initializer.

  1. __init__(self: visp._visp.core.ForceTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> None

  2. __init__(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> None

Initialize a force/torque twist transformation matrix from a translation vector t and a rotation matrix R .

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
t

Translation vector.

R

Rotation matrix.

  1. __init__(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> None

Initialize a force/torque twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
t

Translation vector.

thetau

math:theta u rotation vector used to initialize \(R\) .

  1. __init__(self: visp._visp.core.ForceTwistMatrix, tx: float, ty: float, tz: float, tux: float, tuy: float, tuz: float) -> None

Initialize a force/torque twist transformation matrix from a translation vector \({\bf t}=(t_x, t_y, t_z)^T\) and a rotation vector with \(\theta {\bf u}=(\theta u_x, \theta u_y, \theta u_z)^T\) parametrization.

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
tx

Translation vector in meters.

ty

Translation vector in meters.

tz

Translation vector in meters.

tux

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

tuy

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

tuz

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

  1. __init__(self: visp._visp.core.ForceTwistMatrix, R: visp._visp.core.RotationMatrix) -> None

  2. __init__(self: visp._visp.core.ForceTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> None

Methods

__init__

Overloaded function.

buildFrom

Overloaded function.

eye

Initialize the force/torque 6 by 6 twist matrix to identity.

print

Pretty print a force/torque twist matrix.

resize

Overloaded function.

Inherited Methods

getMaxValue

Return the array max value.

hadamard

param m:

Second matrix;

insert

Overloaded function.

insertStatic

Insert array B in array A at the given position.

getRows

Return the number of rows of the 2D array.

save

Overloaded function.

conv2

Overloaded function.

numpy

Numpy view of the underlying array data.

saveYAML

Save an array in a YAML-formatted file.

reshape

getMinValue

Return the array min value.

getCols

Return the number of columns of the 2D array.

t

Compute the transpose of the array.

size

Return the number of elements of the 2D array.

Operators

__doc__

__init__

Overloaded function.

__module__

__mul__

Overloaded function.

Attributes

__annotations__

__hash__

__eq__(*args, **kwargs)

Overloaded function.

  1. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

Equal to comparison operator of a 2D array.

  1. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

Equal to comparison operator of a 2D array.

  1. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

Equal to comparison operator of a 2D array.

__getitem__(*args, **kwargs)

Overloaded function.

  1. __getitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple[int, int]) -> float

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

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

  4. __getitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple) -> numpy.ndarray[numpy.float64]

__init__(*args, **kwargs)

Overloaded function.

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

Initialize a force/torque twist transformation matrix to identity.

  1. __init__(self: visp._visp.core.ForceTwistMatrix, F: visp._visp.core.ForceTwistMatrix) -> None

Initialize a force/torque twist transformation matrix from another force/torque twist matrix.

Parameters:
F

Force/torque twist matrix used as initializer.

  1. __init__(self: visp._visp.core.ForceTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> None

  2. __init__(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> None

Initialize a force/torque twist transformation matrix from a translation vector t and a rotation matrix R .

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
t

Translation vector.

R

Rotation matrix.

  1. __init__(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> None

Initialize a force/torque twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
t

Translation vector.

thetau

math:theta u rotation vector used to initialize \(R\) .

  1. __init__(self: visp._visp.core.ForceTwistMatrix, tx: float, ty: float, tz: float, tux: float, tuy: float, tuz: float) -> None

Initialize a force/torque twist transformation matrix from a translation vector \({\bf t}=(t_x, t_y, t_z)^T\) and a rotation vector with \(\theta {\bf u}=(\theta u_x, \theta u_y, \theta u_z)^T\) parametrization.

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
tx

Translation vector in meters.

ty

Translation vector in meters.

tz

Translation vector in meters.

tux

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

tuy

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

tuz

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

  1. __init__(self: visp._visp.core.ForceTwistMatrix, R: visp._visp.core.RotationMatrix) -> None

  2. __init__(self: visp._visp.core.ForceTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> None

__mul__(*args, **kwargs)

Overloaded function.

  1. __mul__(self: visp._visp.core.ForceTwistMatrix, F: visp._visp.core.ForceTwistMatrix) -> visp._visp.core.ForceTwistMatrix

Operator that allows to multiply a force/torque twist transformation matrix by an other force/torque skew transformation matrix.

#include <visp3/core/vpForceTwistMatrix.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpForceTwistMatrix aFb, bFc;
  // ... initialize the force/torque twist transformations aFb and bFc
  // Compute the force/torque transformation from frame a to c
  vpForceTwistMatrix aFc = aFb * bFc;
}
  1. __mul__(self: visp._visp.core.ForceTwistMatrix, M: visp._visp.core.Matrix) -> visp._visp.core.Matrix

Operator that allows to multiply a force/torque skew transformation matrix by a matrix.

  1. __mul__(self: visp._visp.core.ForceTwistMatrix, H: visp._visp.core.ColVector) -> visp._visp.core.ColVector

Operator that allows to multiply a force/torque skew transformation matrix by a column vector.

For example, this operator can be used to convert a force/torque skew from sensor frame into the probe frame :

\[{^p}{\bf H}_{p} = {^p}{\bf F}_s \; {^s}{\bf H}_s\]

The example below shows how to handle that transformation.

#include <visp3/core/vpColVector.h>
#include <visp3/core/vpForceTwistMatrix.h>
#include <visp3/robot/vpRobotViper850.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
#ifdef VISP_HAVE_VIPER850
  vpRobotViper850 robot;
  vpColVector sH = robot.getForceTorque(); // Get the force/torque measures

  // Set the transformation from sensor frame to the probe frame
  vpHomogeneousMatrix pMs;
  pMs[2][3] = -0.262; // tz only

  // Set the force/torque twist transformation
  vpForceTwistMatrix pFs(pMs); // Twist transformation matrix from probe to sensor frame

  // Compute the resulting force/torque in the probe frame
  vpColVector pH(6); // Force/torque in the probe frame
  pH = pFs * sH;
#endif
}
Parameters:
H

Force/torque skew vector \({\bf H} = [f_x, f_y, f_z, \tau_x, \tau_y, \tau_z]\) .

__ne__(*args, **kwargs)

Overloaded function.

  1. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

Not equal to comparison operator of a 2D array.

  1. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

Not equal to comparison operator of a 2D array.

  1. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

Not equal to comparison operator of a 2D array.

buildFrom(*args, **kwargs)

Overloaded function.

  1. buildFrom(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> visp._visp.core.ForceTwistMatrix

Build a force/torque twist transformation matrix from a translation vector t and a rotation matrix R .

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
t

Translation vector.

R

Rotation matrix.

  1. buildFrom(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> visp._visp.core.ForceTwistMatrix

Initialize a force/torque twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
thetau

math:theta {bf u} rotation vector used to initialise \(\bf R\) .

  1. buildFrom(self: visp._visp.core.ForceTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> visp._visp.core.ForceTwistMatrix

Initialize a force/torque twist transformation matrix from an homogeneous matrix \(M\) with

\[\begin{split}{\bf M} = \left[\begin{array}{cc} {\bf R} & {\bf t} \\{\bf 0}_{1\times 3} & 1 \end{array} \right] \end{split}\]
Parameters:
M

Homogeneous matrix \(M\) used to initialize the velocity twist transformation matrix.

full

Boolean used to indicate which matrix should be filled.

  • When set to true, use the complete force/torque skew transformation:

    \[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]
  • When set to false, use the block diagonal velocity skew transformation:

    \[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{{\bf 0}_{3 \times 3}} & {\bf R} \end{array} \right]\end{split}\]

  1. buildFrom(self: visp._visp.core.ForceTwistMatrix, R: visp._visp.core.RotationMatrix) -> visp._visp.core.ForceTwistMatrix

Build a block diagonal force/torque twist transformation matrix from a rotation matrix R .

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{{\bf 0}_{3 \times 3}} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
R

Rotation matrix.

  1. buildFrom(self: visp._visp.core.ForceTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> visp._visp.core.ForceTwistMatrix

Initialize a force/torque block diagonal twist transformation matrix from a rotation vector with \(\theta u\) parametrization.

\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{{\bf 0}_{3 \times 3}} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
thetau

math:theta {bf u} rotation vector used to initialise \(\bf R\) .

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 0x7f122fb6a440>>

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 0x7f122fb8c0a0>>

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”.

  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 0x7f122fb6a440>>

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 0x7f122fb8c0a0>>

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”.

eye(self) None

Initialize the force/torque 6 by 6 twist matrix to identity.

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}\)

insert(*args, **kwargs)

Overloaded function.

  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.

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.ForceTwistMatrix, s: std::ostream, length: int, intro: str = None) int

Pretty print a force/torque twist matrix. 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 <<(ostream &s,const vpMatrix &m)

Parameters:
s

Stream used for the printing.

length

The suggested width of each matrix 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 matrix. Can be set to zero (or omitted), in which case the introduction is not printed.

Returns:

Returns the common total width for all matrix elements

reshape(self, nrows: int, ncols: int) None
resize(*args, **kwargs)

Overloaded function.

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

This function is not applicable to a velocity twist matrix that is always a 6-by-6 matrix.

  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.

t(self) visp._visp.core.ArrayDouble2D

Compute the transpose of the array.

Returns:

vpArray2D<Type> C = A^T

__hash__ = None