ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dspm::Mat Class Reference

Matrix. More...

#include <mat.h>

Data Structures

struct  Rect
 Rectangular area. More...

Public Member Functions

 Mat (int rows, int cols)
 Mat (float *data, int rows, int cols)
 Mat (float *data, int rows, int cols, int stride)
 Mat ()
virtual ~Mat ()
 Mat (const Mat &src)
 Make copy of matrix.
Mat getROI (int startRow, int startCol, int roiRows, int roiCols)
 Create a subset of matrix as ROI (Region of Interest).
Mat getROI (int startRow, int startCol, int roiRows, int roiCols, int stride)
 Create a subset of matrix as ROI (Region of Interest).
Mat getROI (const Mat::Rect &rect)
 Create a subset of matrix as ROI (Region of Interest).
void Copy (const Mat &src, int row_pos, int col_pos)
void CopyHead (const Mat &src)
 copy header of matrix
void PrintHead (void)
 print matrix header
Mat Get (int row_start, int row_size, int col_start, int col_size)
Mat Get (const Mat::Rect &rect)
Matoperator= (const Mat &src)
float & operator() (int row, int col)
const float & operator() (int row, int col) const
Matoperator+= (const Mat &A)
Matoperator+= (float C)
Matoperator-= (const Mat &A)
Matoperator-= (float C)
Matoperator*= (const Mat &A)
Matoperator*= (float C)
Matoperator/= (float C)
Matoperator/= (const Mat &B)
Mat operator^ (int C)
void swapRows (int row1, int row2)
Mat t ()
Mat block (int startRow, int startCol, int blockRows, int blockCols)
void normalize (void)
float norm (void)
void clear (void)
Mat gaussianEliminate ()
 Gaussian Elimination.
Mat rowReduceFromGaussian ()
Mat inverse ()
Mat pinv ()
float det (int n)

Static Public Member Functions

static Mat eye (int size)
static Mat ones (int size)
static Mat ones (int rows, int cols)
static Mat solve (Mat A, Mat b)
 Solve the matrix.
static Mat bandSolve (Mat A, Mat b, int k)
 Band solve the matrix.
static Mat roots (Mat A, Mat y)
 Solve the matrix.
static float dotProduct (Mat A, Mat B)
 Dotproduct of two vectors.
static Mat augment (Mat A, Mat B)
 Augmented matrices.

Data Fields

int rows
int cols
int stride
int padding
float * data
int length
bool ext_buff
bool sub_matrix

Static Public Attributes

static float abs_tol = 1e-10

Private Member Functions

Mat cofactor (int row, int col, int n)
Mat adjoint ()
void allocate ()
Mat expHelper (const Mat &m, int num)

Detailed Description

Matrix.

The Mat class provides basic matrix operations on single-precision floating point values.

Definition at line 30 of file mat.h.

Constructor & Destructor Documentation

◆ Mat() [1/5]

dspm::Mat::Mat ( int rows,
int cols )

Constructor allocate internal buffer.

Parameters
[in]rowsamount of matrix rows
[in]colsamount of matrix columns

Definition at line 69 of file mat.cpp.

70{
71 ESP_LOGD("Mat", "Mat(%i, %i)", rows, cols);
72 this->rows = rows;
73 this->cols = cols;
74 this->sub_matrix = false;
75 this->stride = cols;
76 this->padding = 0;
77 allocate();
78 memset(this->data, 0, this->length * sizeof(float));
79}
int stride
Definition mat.h:35
float * data
Definition mat.h:37
int cols
Definition mat.h:34
int length
Definition mat.h:38
bool sub_matrix
Definition mat.h:41
int padding
Definition mat.h:36
void allocate()
Definition mat.cpp:834
int rows
Definition mat.h:33
#define ESP_LOGD
Definition esp_log.h:22

References allocate(), cols, data, ESP_LOGD, length, padding, rows, stride, and sub_matrix.

Referenced by adjoint(), augment(), bandSolve(), block(), cofactor(), Copy(), CopyHead(), det(), dotProduct(), expHelper(), eye(), gaussianEliminate(), Get(), Get(), getROI(), getROI(), getROI(), inverse(), Mat(), ones(), ones(), operator*=(), operator*=(), operator+=(), operator+=(), operator-=(), operator-=(), operator/=(), operator/=(), operator=(), operator^(), pinv(), roots(), rowReduceFromGaussian(), solve(), and t().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mat() [2/5]

dspm::Mat::Mat ( float * data,
int rows,
int cols )

Constructor use external buffer.

Parameters
[in]dataexternal buffer with row-major matrix data
[in]rowsamount of matrix rows
[in]colsamount of matrix columns

Definition at line 81 of file mat.cpp.

82{
83 ESP_LOGD("Mat", "Mat(data, %i, %i)", rows, cols);
84 this->rows = rows;
85 this->cols = cols;
86 this->sub_matrix = false;
87 this->stride = cols;
88 this->padding = 0;
89 this->length = this->rows * this->cols;
90 allocate();
91 this->ext_buff = false;
92 for (size_t i = 0; i < this->length; i++) {
93 this->data[i] = data[i];
94 }
95}
bool ext_buff
Definition mat.h:40

References allocate(), cols, data, ESP_LOGD, ext_buff, length, padding, rows, stride, and sub_matrix.

Here is the call graph for this function:

◆ Mat() [3/5]

dspm::Mat::Mat ( float * data,
int rows,
int cols,
int stride )

Constructor

Parameters
[in]dataexternal buffer with row-major matrix data
[in]rowsamount of matrix rows
[in]colsamount of matrix columns
[in]stridecol stride

Definition at line 57 of file mat.cpp.

58{
59 this->rows = roi_rows;
60 this->cols = roi_cols;
61 this->stride = stride;
62 this->padding = stride - roi_cols;
63 this->length = this->rows * this->cols;
64 this->sub_matrix = true;
65 this->ext_buff = true;
66 this->data = data;
67}

References cols, data, ext_buff, length, padding, rows, stride, and sub_matrix.

◆ Mat() [4/5]

dspm::Mat::Mat ( )

Allocate matrix with undefined size.

Definition at line 98 of file mat.cpp.

99{
100 this->rows = 1;
101 this->cols = 1;
102 this->sub_matrix = false;
103 this->stride = cols;
104 this->padding = 0;
105 ESP_LOGD("Mat", "Mat()");
106
107 allocate();
108 this->data[0] = 0;
109}

References allocate(), cols, data, ESP_LOGD, padding, rows, stride, and sub_matrix.

Referenced by det().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Mat()

dspm::Mat::~Mat ( )
virtual

Definition at line 111 of file mat.cpp.

112{
113 ESP_LOGD("Mat", "~Mat(%i, %i), ext_buff=%i, data = %p", this->rows, this->cols, this->ext_buff, this->data);
114 if (false == this->ext_buff) {
115 delete[] data;
116 }
117}

References cols, data, ESP_LOGD, ext_buff, and rows.

◆ Mat() [5/5]

dspm::Mat::Mat ( const Mat & src)

Make copy of matrix.

if src matrix is sub matrix, only the header is copied if src matrix is matrix, header and data are copied

Parameters
[in]srcsource matrix

Definition at line 119 of file mat.cpp.

120{
121 this->rows = m.rows;
122 this->cols = m.cols;
123 this->padding = m.padding;
124 this->stride = m.stride;
125 this->data = m.data;
126 this->sub_matrix = m.sub_matrix;
127
128 if (m.sub_matrix) {
129 this->length = m.length;
130 this->data = m.data;
131 this->ext_buff = true;
132 } else {
133 allocate();
134 memcpy(this->data, m.data, this->length * sizeof(float));
135 }
136}
const int m
Definition test_mmult.c:16

References allocate(), cols, data, ext_buff, length, m, Mat(), padding, rows, stride, and sub_matrix.

Here is the call graph for this function:

Member Function Documentation

◆ adjoint()

Mat dspm::Mat::adjoint ( )
private

Definition at line 783 of file mat.cpp.

784{
785 Mat adj(this->rows, this->cols);
786 if (this->rows == 1) {
787 adj(0, 0) = 1;
788 return adj;
789 }
790
791 // temp is used to store cofactors of A(,)
792 int sign = 1;
793 Mat temp(this->rows, this->cols);
794
795 for (int i = 0; i < this->rows; i++) {
796 for (int j = 0; j < this->cols; j++) {
797 // Get cofactor of A(i,j)
798 temp = this->cofactor( i, j, this->rows);
799
800 // sign of adj(j,i) positive if sum of row
801 // and column indexes is even.
802 sign = ((i + j) % 2 == 0) ? 1 : -1;
803
804 // Interchanging rows and columns to get the
805 // transpose of the cofactor matrix
806 adj(j, i) = (sign) * (temp.det(this->rows - 1));
807 }
808 }
809 return adj;
810}
Mat(int rows, int cols)
Definition mat.cpp:69
Mat cofactor(int row, int col, int n)
Definition mat.cpp:722

References cofactor(), cols, det(), Mat(), and rows.

Referenced by inverse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocate()

void dspm::Mat::allocate ( )
private

Definition at line 834 of file mat.cpp.

835{
836 this->ext_buff = false;
837 this->length = this->rows * this->cols;
838 data = new float[this->length];
839 ESP_LOGD("Mat", "allocate(%i) = %p", this->length, this->data);
840}

References cols, data, ESP_LOGD, ext_buff, length, and rows.

Referenced by Mat(), Mat(), Mat(), Mat(), and operator=().

Here is the caller graph for this function:

◆ augment()

Mat dspm::Mat::augment ( Mat A,
Mat B )
static

Augmented matrices.

Augmented matrices

Parameters
[in]AInput vector A MxN
[in]BInput vector B MxK
Returns
  • Augmented matrix Mx(N+K)

Definition at line 585 of file mat.cpp.

586{
587 Mat AB(A.rows, A.cols + B.cols);
588 for (int i = 0; i < AB.rows; ++i) {
589 for (int j = 0; j < AB.cols; ++j) {
590 if (j < A.cols) {
591 AB(i, j) = A(i, j);
592 } else {
593 AB(i, j) = B(i, j - A.cols);
594 }
595 }
596 }
597 return AB;
598}
float B[8][16]
Definition test_mmult.c:21
float A[4][8]
Definition test_mmult.c:20

References A, B, cols, Mat(), and rows.

Referenced by pinv(), and roots().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bandSolve()

Mat dspm::Mat::bandSolve ( Mat A,
Mat b,
int k )
static

Band solve the matrix.

Solve band matrix. Find roots for the matrix A*x = b with bandwidth k.

Parameters
[in]Amatrix [N]x[N] with input coefficients
[in]bvector [N]x[1] with result values
[in]kupper bandwidth value
Returns
  • matrix [N]x[1] with roots

Definition at line 514 of file mat.cpp.

515{
516 // optimized Gaussian elimination
517 int bandsBelow = (k - 1) / 2;
518 for (int i = 0; i < A.rows; ++i) {
519 if (A(i, i) == 0) {
520 // pivot 0 - error
521 ESP_LOGW("Mat", "Error: the coefficient matrix has 0 as a pivot. Please fix the input and try again.");
522 Mat err_result(b.rows, 1);
523 memset(err_result.data, 0, b.rows * sizeof(float));
524 return err_result;
525 }
526 float a_ii = 1 / A(i, i);
527 for (int j = i + 1; j < A.rows && j <= i + bandsBelow; ++j) {
528 int k = i + 1;
529 while ((k < A.cols) && (fabs(A(j, k)) > abs_tol)) {
530 A(j, k) -= A(i, k) * (A(j, i) * a_ii);
531 k++;
532 }
533 b(j, 0) -= b(i, 0) * (A(j, i) * a_ii);
534 A(j, i) = 0;
535 }
536 }
537
538 // Back substitution
539 Mat x(b.rows, 1);
540 x((x.rows - 1), 0) = b((x.rows - 1), 0) / A((x.rows - 1), (x.rows - 1));
541 for (int i = x.rows - 2; i >= 0; --i) {
542 float sum = 0;
543 for (int j = i + 1; j < x.rows; ++j) {
544 sum += A(i, j) * x(j, 0);
545 }
546 x(i, 0) = (b(i, 0) - sum) / A(i, i);
547 }
548
549 return x;
550}
static float abs_tol
Definition mat.h:39
float x[1024]
Definition test_fir.c:10
const int k
Definition test_mmult.c:18

References A, abs_tol, data, k, Mat(), rows, and x.

Here is the call graph for this function:

◆ block()

Mat dspm::Mat::block ( int startRow,
int startCol,
int blockRows,
int blockCols )

Return part of matrix from defined position (startRow, startCol) as a matrix[blockRows x blockCols].

Parameters
[in]startRowstart row position
[in]startColstart column position
[in]blockRowsamount of rows in result matrix
[in]blockColsamount of columns in the result matrix
Returns
  • matrix [blockRows]x[blockCols]

Definition at line 433 of file mat.cpp.

434{
435 Mat result(blockRows, blockCols);
436 for (int i = 0; i < blockRows; ++i) {
437 for (int j = 0; j < blockCols; ++j) {
438 result(i, j) = (*this)(startRow + i, startCol + j);
439 }
440 }
441 return result;
442}

References Mat().

Here is the call graph for this function:

◆ clear()

void dspm::Mat::clear ( void )

The method fill 0 to the matrix structure.

Definition at line 425 of file mat.cpp.

426{
427 for (int row = 0; row < this->rows; row++) {
428 memset(this->data + (row * this->stride), 0, this->cols * sizeof(float));
429 }
430}

References cols, data, rows, and stride.

◆ cofactor()

Mat dspm::Mat::cofactor ( int row,
int col,
int n )
private

Definition at line 722 of file mat.cpp.

723{
724 int i = 0, j = 0;
725 Mat result(n, n);
726 // Looping for each element of the matrix
727 for (int r = 0; r < n; r++) {
728 for (int c = 0; c < n; c++) {
729 // Copying into temporary matrix only those element
730 // which are not in given row and column
731 if (r != row && c != col) {
732 result(i, j++) = (*this)(r, c);
733
734 // Row is filled, so increase row index and
735 // reset col index
736 if (j == this->rows - 1) {
737 j = 0;
738 i++;
739 }
740 }
741 }
742 }
743 return result;
744}
const int n
Definition test_mmult.c:17

References Mat(), n, and rows.

Referenced by adjoint().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Copy()

void dspm::Mat::Copy ( const Mat & src,
int row_pos,
int col_pos )

Make copy of matrix.

Parameters
[in]srcsource matrix
[in]row_posstart row position of destination matrix
[in]col_posstart col position of destination matrix

Definition at line 168 of file mat.cpp.

169{
170 if ((row_pos + src.rows) > this->rows) {
171 return;
172 }
173 if ((col_pos + src.cols) > this->cols) {
174 return;
175 }
176
177 for (size_t r = 0; r < src.rows; r++) {
178 memcpy(&this->data[(r + row_pos) * this->stride + col_pos], &src.data[r * src.cols], src.cols * sizeof(float));
179 }
180}

References cols, data, Mat(), rows, and stride.

Referenced by ekf_imu13states::StateXdot(), ekf_imu13states::UpdateRefMeasurement(), ekf_imu13states::UpdateRefMeasurement(), and ekf_imu13states::UpdateRefMeasurementMagn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyHead()

void dspm::Mat::CopyHead ( const Mat & src)

copy header of matrix

Make a shallow copy of matrix (no data copy)

Parameters
[in]srcsource matrix

Definition at line 182 of file mat.cpp.

183{
184 if (!this->ext_buff) {
185 delete[] this->data;
186 }
187 this->rows = src.rows;
188 this->cols = src.cols;
189 this->length = src.length;
190 this->padding = src.padding;
191 this->stride = src.stride;
192 this->data = src.data;
193 this->ext_buff = src.ext_buff;
194 this->sub_matrix = src.sub_matrix;
195}

References cols, data, ext_buff, length, Mat(), padding, rows, stride, and sub_matrix.

Here is the call graph for this function:

◆ det()

float dspm::Mat::det ( int n)

Find determinant

Parameters
[in]nelement number in first row
Returns
  • determinant value

Definition at line 746 of file mat.cpp.

747{
748 // Base case : if matrix contains single element
749 if (n == 1) {
750 return (*this)(0, 0);
751 }
752
753 float det = 1.0;
754 Mat *temp = new Mat(n, n);
755 *temp = *this;
756
757 for (int i = 0; i < n; i++) {
758 int pivot = i;
759 for (int j = i + 1; j < n; j++) {
760 if (std::abs((*temp)(j, i)) > std::abs((*temp)(pivot, i))) {
761 pivot = j;
762 }
763 }
764 if (pivot != i) {
765 temp->swapRows(i, pivot);
766 det *= -1;
767 }
768 if ((*temp)(i, i) == 0) {
769 return 0;
770 }
771 det *= (*temp)(i, i);
772 for (int j = i + 1; j < n; j++) {
773 float factor = (*temp)(j, i) / (*temp)(i, i);
774 for (int k = i + 1; k < n; k++) {
775 (*temp)(j, k) -= factor * (*temp)(i, k);
776 }
777 }
778 }
779 delete temp;
780 return det;
781}
float det(int n)
Definition mat.cpp:746
Mat()
Definition mat.cpp:98

References det(), k, Mat(), Mat(), n, and swapRows().

Referenced by adjoint(), det(), and inverse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dotProduct()

float dspm::Mat::dotProduct ( Mat A,
Mat B )
static

Dotproduct of two vectors.

The method returns dotproduct of two vectors

Parameters
[in]AInput vector A Nx1
[in]BInput vector B Nx1
Returns
  • dotproduct value

Definition at line 576 of file mat.cpp.

577{
578 float sum = 0;
579 for (int i = 0; i < a.rows; ++i) {
580 sum += (a(i, 0) * b(i, 0));
581 }
582 return sum;
583}

References Mat(), and rows.

Here is the call graph for this function:

◆ expHelper()

Mat dspm::Mat::expHelper ( const Mat & m,
int num )
private

Definition at line 842 of file mat.cpp.

843{
844 if (num == 0) {
845 return Mat::eye(m.rows);
846 } else if (num == 1) {
847 return m;
848 } else if (num % 2 == 0) { // num is even
849 return expHelper(m * m, num / 2);
850 } else { // num is odd
851 return m * expHelper(m * m, (num - 1) / 2);
852 }
853}
static Mat eye(int size)
Definition mat.cpp:394
Mat expHelper(const Mat &m, int num)
Definition mat.cpp:842

References expHelper(), eye(), m, and Mat().

Referenced by expHelper(), and operator^().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eye()

Mat dspm::Mat::eye ( int size)
static

Create identity matrix. Create a square matrix and fill diagonal with 1.

Parameters
[in]sizematrix size
Returns
  • matrix [N]x[N] with 1 in diagonal

Definition at line 394 of file mat.cpp.

395{
396 Mat temp(size, size);
397 for (int i = 0; i < temp.rows; ++i) {
398 for (int j = 0; j < temp.cols; ++j) {
399 if (i == j) {
400 temp(i, j) = 1;
401 } else {
402 temp(i, j) = 0;
403 }
404 }
405 }
406 return temp;
407}

References cols, Mat(), and rows.

Referenced by ekf::CovariancePrediction(), dispaly_esp_text(), dispaly_esp_text(), dispaly_esp_text(), dispaly_esp_text(), draw_3d_image(), draw_3d_image(), draw_3d_image(), draw_3d_image(), draw_3d_image_task(), draw_3d_image_task(), draw_3d_image_task(), draw_3d_image_task(), draw_3d_image_task(), draw_3d_image_task(), draw_3d_image_task(), draw_3d_image_task(), expHelper(), ekf_imu13states::Init(), ekf_imu13states::LinearizeFG(), pinv(), ekf_imu13states::TestFull(), ekf::UpdateRef(), ekf_imu13states::UpdateRefMeasurement(), and ekf_imu13states::UpdateRefMeasurementMagn().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gaussianEliminate()

Mat dspm::Mat::gaussianEliminate ( )

Gaussian Elimination.

Gaussian Elimination of matrix

Returns
  • result matrix

Definition at line 600 of file mat.cpp.

601{
602 Mat Ab(*this);
603 int rows = Ab.rows;
604 int cols = Ab.cols;
605 int Acols = cols - 1;
606
607 int i = 0; // row tracker
608 int j = 0; // column tracker
609
610 // iterate through the rows
611 while (i < rows) {
612 // find a pivot for the row
613 bool pivot_found = false;
614 while (j < Acols && !pivot_found) {
615 if (Ab(i, j) != 0) { // pivot not equal to 0
616 pivot_found = true;
617 } else { // check for a possible swap
618 int max_row = i;
619 float max_val = 0;
620 for (int k = i + 1; k < rows; ++k) {
621 float cur_abs = Ab(k, j) >= 0 ? Ab(k, j) : -1 * Ab(k, j);
622 if (cur_abs > max_val) {
623 max_row = k;
624 max_val = cur_abs;
625 }
626 }
627 if (max_row != i) {
628 Ab.swapRows(max_row, i);
629 pivot_found = true;
630 } else {
631 j++;
632 }
633 }
634 }
635
636 // perform elimination as normal if pivot was found
637 if (pivot_found) {
638 for (int t = i + 1; t < rows; ++t) {
639 for (int s = j + 1; s < cols; ++s) {
640 Ab(t, s) = Ab(t, s) - Ab(i, s) * (Ab(t, j) / Ab(i, j));
641 if (Ab(t, s) < abs_tol && Ab(t, s) > -1 * abs_tol) {
642 Ab(t, s) = 0;
643 }
644 }
645 Ab(t, j) = 0;
646 }
647 }
648
649 i++;
650 j++;
651 }
652
653 return Ab;
654}
Mat t()
Definition mat.cpp:383

References abs_tol, cols, k, Mat(), rows, swapRows(), and t().

Referenced by pinv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get() [1/2]

Mat dspm::Mat::Get ( const Mat::Rect & rect)

Make copy of matrix.

Parameters
[in]rectrectangular area of interest
Returns
  • result matrix size row_size x col_size

Definition at line 226 of file mat.cpp.

227{
228 return (Get(rect.y, rect.height, rect.x, rect.width));
229}
Mat Get(int row_start, int row_size, int col_start, int col_size)
Definition mat.cpp:209

References Get(), dspm::Mat::Rect::height, Mat(), dspm::Mat::Rect::width, dspm::Mat::Rect::x, and dspm::Mat::Rect::y.

Here is the call graph for this function:

◆ Get() [2/2]

Mat dspm::Mat::Get ( int row_start,
int row_size,
int col_start,
int col_size )

Make copy of matrix.

Parameters
[in]row_startstart row position of source matrix to copy
[in]row_sizesize of wor elements of source matrix to copy
[in]col_startstart col position of source matrix to copy
[in]col_sizesize of wor elements of source matrix to copy
Returns
  • result matrix size row_size x col_size

Definition at line 209 of file mat.cpp.

210{
211 Mat result(row_size, col_size);
212
213 if ((row_start + row_size) > this->rows) {
214 return result;
215 }
216 if ((col_start + col_size) > this->cols) {
217 return result;
218 }
219
220 for (size_t r = 0; r < result.rows; r++) {
221 memcpy(&result.data[r * result.cols], &this->data[(r + row_start) * this->stride + col_start], result.cols * sizeof(float));
222 }
223 return result;
224}

References cols, data, Mat(), and rows.

Referenced by Get(), ekf_imu13states::LinearizeFG(), and operator*=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getROI() [1/3]

Mat dspm::Mat::getROI ( const Mat::Rect & rect)

Create a subset of matrix as ROI (Region of Interest).

Parameters
[in]rectrectangular area of interest
Returns
  • result matrix size rect.rectRows x rect.rectCols

Definition at line 158 of file mat.cpp.

159{
160 return (getROI(rect.y, rect.x, rect.height, rect.width, this->cols));
161}
Mat getROI(int startRow, int startCol, int roiRows, int roiCols)
Create a subset of matrix as ROI (Region of Interest).
Definition mat.cpp:163

References getROI(), dspm::Mat::Rect::height, Mat(), dspm::Mat::Rect::width, dspm::Mat::Rect::x, and dspm::Mat::Rect::y.

Here is the call graph for this function:

◆ getROI() [2/3]

Mat dspm::Mat::getROI ( int startRow,
int startCol,
int roiRows,
int roiCols )

Create a subset of matrix as ROI (Region of Interest).

Parameters
[in]startRowstart row position of source matrix to get the subset matrix from
[in]startColstart col position of source matrix to get the subset matrix from
[in]roiRowssize of row elements of source matrix to get the subset matrix from
[in]roiColssize of col elements of source matrix to get the subset matrix from
Returns
  • result matrix size roiRows x roiCols

Definition at line 163 of file mat.cpp.

164{
165 return (getROI(startRow, startCol, roiRows, roiCols, this->cols));
166}

References cols, getROI(), and Mat().

Referenced by getROI(), and getROI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getROI() [3/3]

Mat dspm::Mat::getROI ( int startRow,
int startCol,
int roiRows,
int roiCols,
int stride )

Create a subset of matrix as ROI (Region of Interest).

Parameters
[in]startRowstart row position of source matrix to get the subset matrix from
[in]startColstart col position of source matrix to get the subset matrix from
[in]roiRowssize of row elements of source matrix to get the subset matrix from
[in]roiColssize of col elements of source matrix to get the subset matrix from
[in]stridenumber of cols + padding between 2 rows
Returns
  • result matrix size roiRows x roiCols

Definition at line 138 of file mat.cpp.

139{
140 Mat result(this->data, roiRows, roiCols, 0);
141
142 if ((startRow + roiRows) > this->rows) {
143 return result;
144 }
145 if ((startCol + roiCols) > this->cols) {
146 return result;
147 }
148
149 const int ptr_move = startRow * this->cols + startCol;
150 float *new_data_ptr = this->data + ptr_move;
151
152 result.data = new_data_ptr;
153 result.stride = stride;
154 result.padding = result.stride - result.cols;
155 return result;
156}

References cols, data, Mat(), padding, rows, and stride.

Here is the call graph for this function:

◆ inverse()

Mat dspm::Mat::inverse ( )

Find the inverse matrix

Returns
  • inverse matrix

Definition at line 812 of file mat.cpp.

813{
814 Mat result(this->rows, this->cols);
815 // Find determinant of matrix
816 float det = this->det(this->rows);
817 if (det == 0) {
818 //std::cout << "Singular matrix, can't find its inverse";
819 return result;
820 }
821
822 // Find adjoint
823 Mat adj = this->adjoint();
824
825 // Find Inverse using formula "inverse(A) = adj(A)/det(A)"
826 for (int i = 0; i < this->rows; i++)
827 for (int j = 0; j < this->cols; j++) {
828 result(i, j) = adj(i, j) / float(det);
829 }
830
831 return result;
832}
Mat adjoint()
Definition mat.cpp:783

References adjoint(), cols, det(), Mat(), and rows.

Here is the call graph for this function:

◆ norm()

float dspm::Mat::norm ( void )

Return norm of the vector. If it's matrix, calculate matrix norm

Returns
  • matrix norm

Definition at line 456 of file mat.cpp.

457{
458 float sqr_norm = 0;
459 for (int i = 0; i < this->rows; ++i) {
460 for (int j = 0; j < this->cols; ++j) {
461 sqr_norm += (*this)(i, j) * (*this)(i, j);
462 }
463 }
464 sqr_norm = sqrtf(sqr_norm);
465 return sqr_norm;
466}

References cols, and rows.

Referenced by draw_3d_image_task(), draw_3d_image_task(), kalman_filter_task(), kalman_filter_task(), kalman_filter_task(), kalman_filter_task(), ekf::rotm2quat(), ekf_imu13states::TestFull(), ekf_imu13states::UpdateRefMeasurement(), ekf_imu13states::UpdateRefMeasurement(), and ekf_imu13states::UpdateRefMeasurementMagn().

Here is the caller graph for this function:

◆ normalize()

void dspm::Mat::normalize ( void )

Normalizes the vector, i.e. divides it by its own norm. If it's matrix, calculate matrix norm

Definition at line 444 of file mat.cpp.

445{
446 float sqr_norm = 0;
447 for (int i = 0; i < this->rows; ++i) {
448 for (int j = 0; j < this->cols; ++j) {
449 sqr_norm += (*this)(i, j) * (*this)(i, j);
450 }
451 }
452 sqr_norm = 1 / sqrtf(sqr_norm);
453 *this *= sqr_norm;
454}

References cols, and rows.

◆ ones() [1/2]

Mat dspm::Mat::ones ( int rows,
int cols )
static

Create matrix with all elements 1. Create a matrix and fill all elements with 1.

Parameters
[in]rowsmatrix rows
[in]colsmatrix cols
Returns
  • matrix [N]x[N] with 1 in all elements

Definition at line 414 of file mat.cpp.

415{
416 Mat temp(rows, cols);
417 for (int row = 0; row < temp.rows; ++row) {
418 for (int col = 0; col < temp.cols; ++col) {
419 temp(row, col) = 1;
420 }
421 }
422 return temp;
423}

References cols, Mat(), and rows.

Here is the call graph for this function:

◆ ones() [2/2]

Mat dspm::Mat::ones ( int size)
static

Create matrix with all elements 1. Create a square matrix and fill all elements with 1.

Parameters
[in]sizematrix size
Returns
  • matrix [N]x[N] with 1 in all elements

Definition at line 409 of file mat.cpp.

410{
411 return (ones(size, size));
412}
static Mat ones(int size)
Definition mat.cpp:409

References Mat(), and ones().

Referenced by ones().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator()() [1/2]

float & dspm::Mat::operator() ( int row,
int col )
inline

Access to the matrix elements.

Parameters
[in]rowrow position
[in]colcolumn position
Returns
  • element of matrix M[row][col]

Definition at line 218 of file mat.h.

219 {
220 return data[row * this->stride + col];
221 }

References data.

◆ operator()() [2/2]

const float & dspm::Mat::operator() ( int row,
int col ) const
inline

Access to the matrix elements.

Parameters
[in]rowrow position
[in]colcolumn position
Returns
  • element of matrix M[row][col]

Definition at line 230 of file mat.h.

231 {
232 return data[row * this->stride + col];
233 }

References data.

◆ operator*=() [1/2]

Mat & dspm::Mat::operator*= ( const Mat & A)

*= operator The operator use DSP optimized implementation of multiplication.

Parameters
[in]Asource matrix
Returns
  • result matrix: result -= A

Definition at line 312 of file mat.cpp.

313{
314 if (this->cols != m.rows) {
315 ESP_LOGW("Mat", "operator *= Error: matrices do not have equal dimensions");
316 return *this;
317 }
318
319 if (this->sub_matrix || m.sub_matrix) {
320 Mat temp = this->Get(0, this->rows, 0, this->cols);
321 dspm_mult_ex_f32(temp.data, m.data, this->data, temp.rows, temp.cols, m.cols, temp.padding, m.padding, this->padding);
322 } else {
323 Mat temp = *this;
324 dspm_mult_f32(temp.data, m.data, this->data, temp.rows, temp.cols, m.cols);
325 }
326 return (*this);
327}
#define dspm_mult_ex_f32
Definition dspm_mult.h:226
#define dspm_mult_f32
Definition dspm_mult.h:221

References cols, data, dspm_mult_ex_f32, dspm_mult_f32, Get(), m, Mat(), padding, rows, and sub_matrix.

Here is the call graph for this function:

◆ operator*=() [2/2]

Mat & dspm::Mat::operator*= ( float C)

+= with constant operator The operator use DSP optimized implementation of multiplication.

Parameters
[in]Cconstant value
Returns
  • result matrix: result *= C

Definition at line 329 of file mat.cpp.

330{
331 if (this->sub_matrix) {
332 dspm_mulc_f32(this->data, this->data, num, this->rows, this->cols, this->padding, this->padding, 1, 1);
333 } else {
334 dsps_mulc_f32_ansi(this->data, this->data, this->length, num, 1, 1);
335 }
336 return *this;
337}
#define dspm_mulc_f32
Definition dspm_mulc.h:57
esp_err_t dsps_mulc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out)
multiply constant

References cols, data, dspm_mulc_f32, dsps_mulc_f32_ansi(), length, Mat(), padding, rows, and sub_matrix.

Here is the call graph for this function:

◆ operator+=() [1/2]

Mat & dspm::Mat::operator+= ( const Mat & A)

+= operator The operator use DSP optimized implementation of multiplication.

Parameters
[in]Asource matrix
Returns
  • result matrix: result += A

Definition at line 262 of file mat.cpp.

263{
264 if ((this->rows != m.rows) || (this->cols != m.cols)) {
265 ESP_LOGW("Mat", "operator += Error: matrices do not have equal dimensions");
266 return *this;
267 }
268
269 if (this->sub_matrix || m.sub_matrix) {
270 dspm_add_f32(this->data, m.data, this->data, this->rows, this->cols, this->padding, m.padding, this->padding, 1, 1, 1);
271 } else {
272 dsps_add_f32(this->data, m.data, this->data, this->length, 1, 1, 1);
273 }
274 return *this;
275}
#define dspm_add_f32
Definition dspm_add.h:62
#define dsps_add_f32
Definition dsps_add.h:84

References data, dspm_add_f32, dsps_add_f32, m, Mat(), rows, and sub_matrix.

Here is the call graph for this function:

◆ operator+=() [2/2]

Mat & dspm::Mat::operator+= ( float C)

+= operator The operator use DSP optimized implementation of multiplication.

Parameters
[in]Cconstant
Returns
  • result matrix: result += C

Definition at line 277 of file mat.cpp.

278{
279 if (this->sub_matrix) {
280 dspm_addc_f32(this->data, this->data, C, this->rows, this->cols, this->padding, this->padding, 1, 1);
281 } else {
282 dsps_addc_f32_ansi(this->data, this->data, this->length, C, 1, 1);
283 }
284 return *this;
285}
#define dspm_addc_f32
Definition dspm_addc.h:57
esp_err_t dsps_addc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out)
add constant
float C[4][16]
Definition test_mmult.c:22

References C, cols, data, dspm_addc_f32, dsps_addc_f32_ansi(), length, Mat(), padding, rows, and sub_matrix.

Here is the call graph for this function:

◆ operator-=() [1/2]

Mat & dspm::Mat::operator-= ( const Mat & A)

-= operator The operator use DSP optimized implementation of multiplication.

Parameters
[in]Asource matrix
Returns
  • result matrix: result -= A

Definition at line 287 of file mat.cpp.

288{
289 if ((this->rows != m.rows) || (this->cols != m.cols)) {
290 ESP_LOGW("Mat", "operator -= Error: matrices do not have equal dimensions");
291 return *this;
292 }
293
294 if (this->sub_matrix || m.sub_matrix) {
295 dspm_sub_f32(this->data, m.data, this->data, this->rows, this->cols, this->padding, m.padding, this->padding, 1, 1, 1);
296 } else {
297 dsps_sub_f32(this->data, m.data, this->data, this->length, 1, 1, 1);
298 }
299 return *this;
300}
#define dspm_sub_f32
Definition dspm_sub.h:58
#define dsps_sub_f32
Definition dsps_sub.h:82

References data, dspm_sub_f32, dsps_sub_f32, m, Mat(), rows, and sub_matrix.

Here is the call graph for this function:

◆ operator-=() [2/2]

Mat & dspm::Mat::operator-= ( float C)

-= operator The operator use DSP optimized implementation of multiplication.

Parameters
[in]Cconstant
Returns
  • result matrix: result -= C

Definition at line 302 of file mat.cpp.

303{
304 if (this->sub_matrix) {
305 dspm_addc_f32(this->data, this->data, -C, this->rows, this->cols, this->padding, this->padding, 1, 1);
306 } else {
307 dsps_addc_f32_ansi(this->data, this->data, this->length, -C, 1, 1);
308 }
309 return *this;
310}

References C, cols, data, dspm_addc_f32, dsps_addc_f32_ansi(), length, Mat(), padding, rows, and sub_matrix.

Here is the call graph for this function:

◆ operator/=() [1/2]

Mat & dspm::Mat::operator/= ( const Mat & B)

/= operator

Parameters
[in]Bsource matrix
Returns
  • result matrix: result[i,j] = result[i,j]/B[i,j]

Definition at line 339 of file mat.cpp.

340{
341 if ((this->rows != B.rows) || (this->cols != B.cols)) {
342 ESP_LOGW("Mat", "operator /= Error: matrices do not have equal dimensions");
343 return *this;
344 }
345
346 for (int row = 0; row < this->rows; row++) {
347 for (int col = 0; col < this->cols; col++) {
348 (*this)(row, col) = (*this)(row, col) / B(row, col);
349 }
350 }
351 return (*this);
352}

References B, cols, Mat(), and rows.

Here is the call graph for this function:

◆ operator/=() [2/2]

Mat & dspm::Mat::operator/= ( float C)

/= with constant operator The operator use DSP optimized implementation of multiplication.

Parameters
[in]Cconstant value
Returns
  • result matrix: result /= C

Definition at line 354 of file mat.cpp.

355{
356 if (this->sub_matrix) {
357 dspm_mulc_f32(this->data, this->data, 1 / num, this->rows, this->cols, this->padding, this->padding, 1, 1);
358 } else {
359 dsps_mulc_f32_ansi(this->data, this->data, this->length, 1 / num, 1, 1);
360 }
361 return *this;
362}

References cols, data, dspm_mulc_f32, dsps_mulc_f32_ansi(), length, Mat(), padding, rows, and sub_matrix.

Here is the call graph for this function:

◆ operator=()

Mat & dspm::Mat::operator= ( const Mat & src)

Copy operator

Parameters
[in]srcsource matrix
Returns
  • matrix copy

Definition at line 231 of file mat.cpp.

232{
233 if (this == &m) {
234 return *this;
235 }
236
237 // matrix dimensions not equal
238 if (this->rows != m.rows || this->cols != m.cols) {
239 // left operand is a sub-matrix - error
240 if (this->sub_matrix) {
241 ESP_LOGE("Mat", "operator = Error for sub-matrices: operands matrices dimensions %dx%d and %dx%d do not match", this->rows, this->cols, m.rows, m.cols);
242 return *this;
243 }
244 if (!this->ext_buff) {
245 delete[] this->data;
246 }
247 this->ext_buff = false;
248 this->rows = m.rows;
249 this->cols = m.cols;
250 this->stride = this->cols;
251 this->padding = 0;
252 this->sub_matrix = false;
253 allocate();
254 }
255
256 for (int row = 0; row < this->rows; row++) {
257 memcpy(this->data + (row * this->stride), m.data + (row * m.stride), this->cols * sizeof(float));
258 }
259 return *this;
260}

References allocate(), cols, data, ext_buff, m, Mat(), padding, rows, stride, and sub_matrix.

Here is the call graph for this function:

◆ operator^()

Mat dspm::Mat::operator^ ( int C)

^= xor with constant operator The operator use DSP optimized implementation of multiplication.

Parameters
[in]Cconstant value
Returns
  • result matrix: result ^= C

Definition at line 364 of file mat.cpp.

365{
366 Mat temp(*this);
367 return expHelper(temp, num);
368}

References expHelper(), and Mat().

Here is the call graph for this function:

◆ pinv()

Mat dspm::Mat::pinv ( )

Find pseudo inverse matrix

Returns
  • inverse matrix

Definition at line 707 of file mat.cpp.

708{
709 Mat I = Mat::eye(this->rows);
710 Mat AI = Mat::augment(*this, I);
711 Mat U = AI.gaussianEliminate();
712 Mat IAInverse = U.rowReduceFromGaussian();
713 Mat AInverse(this->rows, this->cols);
714 for (int i = 0; i < this->rows; ++i) {
715 for (int j = 0; j < this->cols; ++j) {
716 AInverse(i, j) = IAInverse(i, j + this->cols);
717 }
718 }
719 return AInverse;
720}
static Mat augment(Mat A, Mat B)
Augmented matrices.
Definition mat.cpp:585

References augment(), cols, eye(), gaussianEliminate(), Mat(), rowReduceFromGaussian(), and rows.

Referenced by ekf::UpdateRef().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintHead()

void dspm::Mat::PrintHead ( void )

print matrix header

Print all information about matrix to the terminal

Parameters
[in]srcsource matrix

Definition at line 197 of file mat.cpp.

198{
199 std::cout << "rows " << this->rows << std::endl;
200 std::cout << "cols " << this->cols << std::endl;
201 std::cout << "lenght " << this->length << std::endl;
202 std::cout << "data " << this->data << std::endl;
203 std::cout << "ext_buff " << this->ext_buff << std::endl;
204 std::cout << "sub_mat " << this->sub_matrix << std::endl;
205 std::cout << "stride " << this->stride << std::endl;
206 std::cout << "padding " << this->padding << std::endl << std::endl;
207}

References cols, data, ext_buff, length, padding, rows, stride, and sub_matrix.

◆ roots()

Mat dspm::Mat::roots ( Mat A,
Mat y )
static

Solve the matrix.

Different way to solve the matrix. Find roots for the matrix A*x = y

Parameters
[in]Amatrix [N]x[N] with input coefficients
[in]yvector [N]x[1] with result values
Returns
  • matrix [N]x[1] with roots

Definition at line 552 of file mat.cpp.

553{
554 int n = A.cols + 1;
555
556 Mat result(y.rows, 1);
557
558 Mat g_m = Mat::augment(A, y);
559 for (int j = 0; j < A.cols; j++) {
560 float g_jj = 1 / g_m(j, j);
561 for (int i = 0; i < A.cols; i++) {
562 if (i != j) {
563 float c = g_m(i, j) * g_jj;
564 for (int k = 0; k < n; k++) {
565 g_m(i, k) = g_m(i, k) - c * g_m(j, k);
566 }
567 }
568 }
569 }
570 for (int i = 0; i < A.rows; i++) {
571 result(i, 0) = g_m(i, A.cols) / g_m(i, i);
572 }
573 return result;
574}
float y[1024]
Definition test_fir.c:11

References A, augment(), k, Mat(), n, and y.

Here is the call graph for this function:

◆ rowReduceFromGaussian()

Mat dspm::Mat::rowReduceFromGaussian ( )

Row reduction for Gaussian elimination

Returns
  • result matrix

Definition at line 656 of file mat.cpp.

657{
658 Mat R(*this);
659 int rows = R.rows;
660 int cols = R.cols;
661
662 int i = rows - 1; // row tracker
663 int j = cols - 2; // column tracker
664
665 // iterate through every row
666 while (i >= 0) {
667 // find the pivot column
668 int k = j - 1;
669 while (k >= 0) {
670 if (R(i, k) != 0) {
671 j = k;
672 }
673 k--;
674 }
675
676 // zero out elements above pivots if pivot not 0
677 if (R(i, j) != 0) {
678 for (int t = i - 1; t >= 0; --t) {
679 for (int s = 0; s < cols; ++s) {
680 if (s != j) {
681 R(t, s) = R(t, s) - R(i, s) * (R(t, j) / R(i, j));
682 if (R(t, s) < abs_tol && R(t, s) > -1 * abs_tol) {
683 R(t, s) = 0;
684 }
685 }
686 }
687 R(t, j) = 0;
688 }
689
690 // divide row by pivot
691 for (int k = j + 1; k < cols; ++k) {
692 R(i, k) = R(i, k) / R(i, j);
693 if (R(i, k) < abs_tol && R(i, k) > -1 * abs_tol) {
694 R(i, k) = 0;
695 }
696 }
697 R(i, j) = 1;
698 }
699
700 i--;
701 j--;
702 }
703
704 return R;
705}

References abs_tol, cols, k, Mat(), rows, and t().

Referenced by pinv().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ solve()

Mat dspm::Mat::solve ( Mat A,
Mat b )
static

Solve the matrix.

Solve matrix. Find roots for the matrix A*x = b

Parameters
[in]Amatrix [N]x[N] with input coefficients
[in]bvector [N]x[1] with result values
Returns
  • matrix [N]x[1] with roots

Definition at line 468 of file mat.cpp.

469{
470 // Gaussian elimination
471 for (int i = 0; i < A.rows; ++i) {
472 if (A(i, i) == 0) {
473 // pivot 0 - error
474 ESP_LOGW("Mat", "Error: the coefficient matrix has 0 as a pivot. Please fix the input and try again.");
475 Mat err_result(0, 0);
476 return err_result;
477 }
478 float a_ii = 1 / A(i, i);
479 for (int j = i + 1; j < A.rows; ++j) {
480 float a_ji = A(j, i) * a_ii;
481 for (int k = i + 1; k < A.cols; ++k) {
482 A(j, k) -= A(i, k) * a_ji;
483 if ((A(j, k) < abs_tol) && (A(j, k) > -1 * abs_tol)) {
484 A(j, k) = 0;
485 }
486 }
487 b(j, 0) -= b(i, 0) * a_ji;
488 if (A(j, 0) < abs_tol && A(j, 0) > -1 * abs_tol) {
489 A(j, 0) = 0;
490 }
491 A(j, i) = 0;
492 }
493 }
494
495 // Back substitution
496 Mat x(b.rows, 1);
497 x((x.rows - 1), 0) = b((x.rows - 1), 0) / A((x.rows - 1), (x.rows - 1));
498 if (x((x.rows - 1), 0) < abs_tol && x((x.rows - 1), 0) > -1 * abs_tol) {
499 x((x.rows - 1), 0) = 0;
500 }
501 for (int i = x.rows - 2; i >= 0; --i) {
502 float sum = 0;
503 for (int j = i + 1; j < x.rows; ++j) {
504 sum += A(i, j) * x(j, 0);
505 }
506 x(i, 0) = (b(i, 0) - sum) / A(i, i);
507 if (x(i, 0) < abs_tol && x(i, 0) > -1 * abs_tol) {
508 x(i, 0) = 0;
509 }
510 }
511 return x;
512}

References A, abs_tol, k, Mat(), rows, and x.

Here is the call graph for this function:

◆ swapRows()

void dspm::Mat::swapRows ( int row1,
int row2 )

Swap two rows between each other.

Parameters
[in]row1position of first row
[in]row2position of second row

Definition at line 370 of file mat.cpp.

371{
372 if ((this->rows <= r1) || (this->rows <= r2)) {
373 ESP_LOGW("Mat", "swapRows Error: row %d or %d out of matrix row %d range", r1, r2, this->rows);
374 } else {
375 for (int i = 0; i < this->cols; i++) {
376 float temp = this->data[r1 * this->stride + i];
377 this->data[r1 * this->stride + i] = this->data[r2 * this->stride + i];
378 this->data[r2 * this->stride + i] = temp;
379 }
380 }
381}

References cols, data, rows, and stride.

Referenced by det(), and gaussianEliminate().

Here is the caller graph for this function:

◆ t()

Mat dspm::Mat::t ( )

Matrix transpose. Change rows and columns between each other.

Returns
  • transposed matrix

Definition at line 383 of file mat.cpp.

384{
385 Mat ret(this->cols, this->rows);
386 for (int i = 0; i < this->rows; ++i) {
387 for (int j = 0; j < this->cols; ++j) {
388 ret(j, i) = this->data[i * this->stride + j];
389 }
390 }
391 return ret;
392}

References cols, data, Mat(), rows, and stride.

Referenced by ekf::CovariancePrediction(), draw_3d_image_task(), draw_3d_image_task(), gaussianEliminate(), rowReduceFromGaussian(), ekf_imu13states::TestFull(), update_rotation_matrix(), ekf::UpdateRef(), ekf_imu13states::UpdateRefMeasurement(), ekf_imu13states::UpdateRefMeasurement(), and ekf_imu13states::UpdateRefMeasurementMagn().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ abs_tol

float dspm::Mat::abs_tol = 1e-10
static

Max acceptable absolute tolerance

Definition at line 39 of file mat.h.

Referenced by bandSolve(), gaussianEliminate(), rowReduceFromGaussian(), and solve().

◆ cols

◆ data

◆ ext_buff

bool dspm::Mat::ext_buff

Flag indicates that matrix use external buffer

Definition at line 40 of file mat.h.

Referenced by allocate(), CopyHead(), Mat(), Mat(), Mat(), operator=(), PrintHead(), and ~Mat().

◆ length

int dspm::Mat::length

Total amount of data in data array

Definition at line 38 of file mat.h.

Referenced by allocate(), CopyHead(), Mat(), Mat(), Mat(), Mat(), operator*=(), operator+=(), operator-=(), operator/=(), and PrintHead().

◆ padding

◆ rows

◆ stride

int dspm::Mat::stride

Stride = (number of elements in a row) + padding

Definition at line 35 of file mat.h.

Referenced by clear(), Copy(), CopyHead(), getROI(), Mat(), Mat(), Mat(), Mat(), Mat(), operator=(), PrintHead(), swapRows(), and t().

◆ sub_matrix

bool dspm::Mat::sub_matrix

Flag indicates that matrix is a subset of another matrix

Definition at line 41 of file mat.h.

Referenced by CopyHead(), Mat(), Mat(), Mat(), Mat(), Mat(), dspm::operator*(), operator*=(), operator*=(), dspm::operator+(), operator+=(), operator+=(), dspm::operator-(), operator-=(), operator-=(), operator/=(), operator=(), and PrintHead().


The documentation for this class was generated from the following files: