ifw-odp 5.1.1
 
Loading...
Searching...
No Matches
matrix.hpp
Go to the documentation of this file.
1
7
8#ifndef ODP_MATRIX_HPP
9#define ODP_MATRIX_HPP
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15// System header files
16#include <iostream>
17
18// CPL header files
19#include "cpl_matrix.h"
20
21// Local header files
23
24
25namespace ifw::odp {
37 class Matrix : virtual public odp::Error
38 {
39 public:
46 Matrix();
47
55 explicit Matrix(const Matrix &matrix);
56
65 explicit Matrix(cpl_size rows, cpl_size cols);
66
73 virtual ~Matrix();
74
80 inline bool IsMatrix() const;
81
89 void GetMatrixPtr(void **data_ptr) const;
90
96 inline void* GetMatrixPtr() const;
97
103 inline cpl_matrix* GetCplMatrix() const;
104
111 inline void SetCplMatrix(cpl_matrix *matrix);
112
118 inline cpl_size GetNumCols() const;
119
125 inline cpl_size GetNumRows() const;
126
138 void Get(cpl_size row,
139 cpl_size col,
140 double *value) const;
141
152 double Get(cpl_size row,
153 cpl_size col);
154
166 void Set(cpl_size row,
167 cpl_size col,
168 double value);
169
177 std::string GetSize() const;
178
185 Matrix& Sqrt(const Matrix& matrix);
186
197 void Product(const Matrix&, Matrix *product);
198
208 void Transpose(Matrix *transpose);
209
223 void Solve(const Matrix&, Matrix *solved);
224
238 void SolveNormal(const Matrix&, Matrix *solved);
239
251 void Invert(Matrix *inverse);
252
268 void Append(const Matrix& matrix, int mode);
269
284 bool IsDiagonal(const double tolerance);
285
301 bool IsIdentity(const double tolerance);
302
321 bool IsZero(const double tolerance);
322
323 // Object operators
324
332 Matrix& operator+(const double);
333
341 Matrix& operator+(const Matrix&);
342
350 Matrix& operator-(const double);
351
359 Matrix& operator-(const Matrix&);
360
368 Matrix& operator/(const double);
369
377 Matrix& operator/(const Matrix&);
378
386 Matrix& operator*(const double);
387
395 Matrix& operator*(const Matrix&);
396
404 Matrix& operator+=(const double);
405
413 Matrix& operator+=(const Matrix&);
414
422 Matrix& operator-=(const double);
423
431 Matrix& operator-=(const Matrix&);
432
440 Matrix& operator/=(const double);
441
449 Matrix& operator/=(const Matrix&);
450
458 Matrix& operator*=(const double);
459
467 Matrix& operator*=(const Matrix&);
468
475 Matrix& operator=(const Matrix&);
476
484 bool operator==(const Matrix&) const;
485
492 bool operator!=(const Matrix&) const;
493
501 friend std::ostream& operator<<(std::ostream &os, const Matrix &matrix);
502
503 private:
511 void Delete();
512
513 protected:
514 cpl_matrix *m_cpl_matrix;
515
516 };
517
518}
519#include "matrix.ipp"
520
521#endif
522
523
524
525
526
527
528
529
This class handle the errors produced by the calling of image processing routines.
Definition error.hpp:34
Matrix & operator-(const double)
Overload operator-.
Definition matrix.cpp:275
bool IsDiagonal(const double tolerance)
Check if the matrix is diagonal.
Definition matrix.cpp:210
friend std::ostream & operator<<(std::ostream &os, const Matrix &matrix)
Overload operator<<.
Definition matrix.cpp:481
Matrix & operator*(const double)
Overload operator*.
Definition matrix.cpp:311
Matrix & operator-=(const double)
Overload operator-=.
Definition matrix.cpp:349
void Invert(Matrix *inverse)
Find a matrix inverse.
Definition matrix.cpp:184
void Solve(const Matrix &, Matrix *solved)
Solution of linear system .
Definition matrix.cpp:152
void Transpose(Matrix *transpose)
Create transposed matrix.
Definition matrix.cpp:136
Matrix & operator*=(const double)
Overload operator*=.
Definition matrix.cpp:387
std::string GetSize() const
Get the size of the matrix in the format [row]x[col].
Definition matrix.cpp:104
Matrix & Sqrt(const Matrix &matrix)
It computes the sqrt of each element in the matrix.
Definition matrix.cpp:466
void Product(const Matrix &, Matrix *product)
Rows-by-columns product of two matrices.
Definition matrix.cpp:114
Matrix & operator=(const Matrix &)
Overload operator=.
Definition matrix.cpp:407
virtual ~Matrix()
Class destructor.
Definition matrix.cpp:54
cpl_size GetNumRows() const
Get number of rows.
cpl_matrix * GetCplMatrix() const
Get CPL matrix pointer.
Matrix & operator+=(const double)
Overload operator+=.
Definition matrix.cpp:330
bool IsMatrix() const
Check is CPL matrix is not null.
bool IsIdentity(const double tolerance)
Check for identity matrix.
Definition matrix.cpp:223
Matrix & operator/=(const double)
Overload operator/=.
Definition matrix.cpp:368
void Append(const Matrix &matrix, int mode)
Append a matrix to another.
Definition matrix.cpp:199
void SetCplMatrix(cpl_matrix *matrix)
Set CPL image.
void SolveNormal(const Matrix &, Matrix *solved)
Solution of overdetermined linear equations in a least squares sense.
Definition matrix.cpp:168
void Set(cpl_size row, cpl_size col, double value)
Set an element value in the matrix.
Definition matrix.cpp:94
Matrix()
Class constructor.
Definition matrix.cpp:20
Matrix & operator/(const double)
Overload operator/.
Definition matrix.cpp:293
cpl_size GetNumCols() const
Get number of matrix columns.
bool operator==(const Matrix &) const
Overload operator==.
Definition matrix.cpp:419
cpl_matrix * m_cpl_matrix
Definition matrix.hpp:514
bool operator!=(const Matrix &) const
Overload operator !=.
Definition matrix.cpp:442
Matrix & operator+(const double)
Overload operator+.
Definition matrix.cpp:254
void * GetMatrixPtr() const
Get pointer to matrix data.
void Get(cpl_size row, cpl_size col, double *value) const
Get value of an element in the matrix.
Definition matrix.cpp:67
bool IsZero(const double tolerance)
Check for zero matrix.
Definition matrix.cpp:235
Array class source file.
Definition array.cpp:14