25#define RES(v) ((std::vector<T> *)v)
49 size_t nrows = in.
rows();
50 size_t ncols = in.
cols();
52 for (
size_t r = 0; r < nrows; r++) {
70 size_t nrows = in.
rows();
71 size_t ncols = in.
cols();
73 for (
size_t c = 0;
c < ncols;
c++) {
93 const int offset=in.
cols()-(
c2-
c1+1);
95 if (i ==
nullptr || t ==
nullptr) {
99 for(
size_t r=0;r<=(
r2-
r1);r++)
174 std::string
spacer((width<0) ?
"\t" :
" ");
177 std::string ret =
"";
179 const double* src = (*this).data();
184 for (r = 0; r <
nrows; r++) {
197void Matrix::updatePointers()
199 if (matrix !=
nullptr) {
204 matrix=
new double* [
nrows];
208 for(r=1;r<
nrows; r++)
210 matrix[r]=matrix[r-1]+
ncols;
231 for (
size_t k = 0;
k <
nelem;
k++) {
240 if (matrix !=
nullptr) {
262 for (
size_t r = 0; r <
copy_r; r++)
264 const double*
src_row = matrix[r];
307 for (
size_t r = 0; r <
nrows; r++) {
333 for (
size_t c = 0;
c <
ncols;
c++) {
359 for (
size_t r = 0; r <
nrows; r++) {
360 for (
size_t c = 0;
c <
ncols;
c++) {
361 ret[
c][r] = (*this)[r][
c];
373 for (
size_t c = 0;
c <
ncols;
c++) {
374 ret[
c] = (*this)[r][
c];
385 for (
size_t r = 0; r <
nrows; r++) {
386 ret[r] = (*this)[r][
c];
394 if (r >=
rows() ||
c + size - 1 >=
cols()) {
400 for (
size_t i = 0; i < size; i++) {
401 ret[i] = (*this)[r][
c + i];
409 if (r + size - 1 >=
rows() ||
c >=
cols()) {
415 for (
size_t i = 0; i < size; i++) {
416 ret[i] = (*this)[r + i][
c];
431 for (
size_t r = 0; r <
tmpR; r++,
c++) {
447 for (
size_t r = 0; r <
tmpR; r++,
c++) {
448 (*this)[r][
c] = d[r];
464 if (
tmp1 ==
nullptr ||
tmp2 ==
nullptr) {
485 for (
size_t c = 0;
c <
ncols;
c++) {
486 (*this)[
row][
c] = r[
c];
498 for (
size_t r = 0; r <
nrows; r++) {
499 (*this)[r][col] =
c[r];
511 for (
size_t i = 0; i < m.
rows(); i++) {
512 for (
size_t j = 0; j < m.
cols(); j++) {
513 (*this)[r + i][
c + j] = m(i, j);
526 for (
size_t i = 0; i < s; i++) {
527 (*this)[r][i +
c] = v[i];
539 for (
size_t i = 0; i < s; i++) {
540 (*this)[r + i][
c] = v[i];
contains the definition of a Matrix type
contains the definition of a Vector type
A mini-server for performing network communication in the background.
std::vector< double > storage
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.
Vector getRow(size_t r) const
Get a row of the matrix as a vector.
Vector subcol(size_t r, size_t c, size_t size) const
Get a subcolumn of the matrix as a vector.
void resize(size_t r, size_t c)
Resize the matrix, if matrix is not empty preserve old content.
bool operator==(const yarp::sig::Matrix &r) const
True iff all elements of a match all element of b.
Matrix transposed() const
Return the transposed of the matrix.
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...
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.
const Matrix & diagonal(const Vector &d)
Build a diagonal matrix, don't resize.
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...
size_t cols() const
Return number of columns.
Vector getCol(size_t c) const
Get a columns of the matrix as a vector.
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.
double * data()
Return a pointer to the first element.
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.
const Matrix & operator=(const Matrix &r)
Copy operator.
size_t rows() const
Return number of rows.
Vector subrow(size_t r, size_t c, size_t size) const
Get a subrow of the matrix as a vector.
Matrix removeCols(size_t first_col, size_t how_many)
Modifies the matrix, removing one or more columns from it.
std::string toString(int precision=-1, int width=-1, const char *endRowStr="\n") const
Print matrix to a string.
const Matrix & eye()
Build an identity matrix, don't resize.
size_t size() const
Returns the number of elements in the vector.
void resize(size_t size)
Resize the vector.
An interface to the operating system, including Port based communication.
std::int32_t NetInt32
Definition of the NetInt32 type.
bool removeRows(const Matrix &in, Matrix &out, size_t first_row, size_t how_many)
bool submatrix(const Matrix &in, Matrix &out, size_t r1, size_t r2, size_t c1, size_t c2)
bool removeCols(const Matrix &in, Matrix &out, size_t first_col, size_t how_many)
#define YARP_END_PACK
Ends 1 byte packing for structs/classes.
#define YARP_BEGIN_PACK
Starts 1 byte packing for structs/classes.