|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #ifndef YARP_SIG_MATRIX_H
11 #define YARP_SIG_MATRIX_H
31 YARP_sig_API bool submatrix(
const Matrix &in, Matrix &out,
size_t r1,
size_t r2,
size_t c1,
size_t c2);
58 void updatePointers();
68 Matrix(
size_t r,
size_t c);
109 void resize(
size_t r,
size_t c);
118 {
return matrix[r]; }
127 {
return matrix[r]; }
136 {
return matrix[r][c]; }
145 {
return matrix[r][c]; }
199 ret.resize(r2-r1+1, c2-c1+1);
298 std::string
toString(
int precision=-1,
int width=-1,
const char* endRowStr=
"\n")
const;
305 {
return (nrows>0&&ncols>0)?storage:0;}
311 inline const double *
data()
const
312 {
return (nrows>0&&ncols>0)?storage:0;}
334 #endif // YARP_SIG_MATRIX_H
bool removeRows(const Matrix &in, Matrix &out, size_t first_row, size_t how_many)
std::string toString(int precision=-1, int width=-1, const char *endRowStr="\n") const
Print matrix to a string.
This is a base class for objects that can be both read from and be written to the YARP network.
Vector subrow(size_t r, size_t c, size_t size) const
Get a subrow of the matrix as a vector.
contains the definition of a Vector type
bool setSubrow(const Vector &v, size_t r, size_t c)
Set a portion of a row of this matrix with the values of the specified vector v.
bool removeCols(const Matrix &in, Matrix &out, size_t first_col, size_t how_many)
Matrix transposed() const
Return the transposed of the matrix.
const Matrix & diagonal(const Vector &d)
Build a diagonal matrix, don't resize.
Matrix removeCols(size_t first_col, size_t how_many)
Modifies the matrix, removing one or more columns from it.
size_t rows() const
Return number of rows.
Matrix submatrix(size_t r1, size_t r2, size_t c1, size_t c2) const
Extract a submatrix from (r1,c1) to (r2,c2) (extremes included), as in Matlab B=A(r1:r2,...
bool setSubcol(const Vector &v, size_t r, size_t c)
Set a portion of a column of this matrix with the values of the specified vector v.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
An interface for writing to a network connection.
const Matrix & eye()
Build an identity matrix, don't resize.
bool setCol(size_t col, const Vector &c)
Set a column of the matrix copying the values from a vector: the vector length must be equal to the n...
size_t cols() const
Return number of columns.
void resize(size_t r, size_t c)
Resize the matrix, if matrix is not empty preserve old content.
double * operator[](size_t r)
Single element access, no range check.
An interface for reading from a network connection.
double * data()
Return a pointer to the first element.
Vector subcol(size_t r, size_t c, size_t size) const
Get a subcolumn of the matrix as a vector.
bool write(yarp::os::ConnectionWriter &connection) const override
Write vector to a connection.
Vector getCol(size_t c) const
Get a columns of the matrix as a vector.
double & operator()(size_t r, size_t c)
Single element access, no range check.
const double & operator()(size_t r, size_t c) const
Single element access, no range check.
The main, catch-all namespace for YARP.
bool submatrix(const Matrix &in, Matrix &out, size_t r1, size_t r2, size_t c1, size_t c2)
bool operator==(const yarp::sig::Matrix &r) const
True iff all elements of a match all element of b.
Matrix removeRows(size_t first_row, size_t how_many)
Modifies the matrix, removing one or more rows from it.
void zero()
Zero the matrix.
const double * operator[](size_t r) const
Single element access, no range check (const version).
Vector getRow(size_t r) const
Get a row of the matrix as a vector.
const double * data() const
Return a pointer to the first element (const version).
const Matrix & operator=(const Matrix &r)
Copy operator.
bool setRow(size_t row, const Vector &r)
Set a row of the matrix copying the values from a vector: the vector length must be equal to the numb...
bool setSubmatrix(const Matrix &m, size_t r, size_t c)
Set a portion of this matrix with the values of the specified matrix m.