Go to the source code of this file.
|
template<int R = RowsAtCompileTime, int C = ColsAtCompileTime> |
Scalar & | operator() (Index i, Index j) |
| Accesses a matrix element (modifiable) by its row and column indices.
|
|
template<int R = RowsAtCompileTime, int C = ColsAtCompileTime> |
const Scalar & | operator() (Index i, Index j) const |
| Accesses a matrix element (non modifiable) by its row and column indices.
|
|
auto & | init (const Scalar &x) |
| Initializes all elements of the matrix with the scalar value x .
|
|
template<typename U_, int R_, int C_> |
bool | operator== (const Matrix< U_, R_, C_ > &x) const |
| Compares this matrix with another matrix for equality.
|
|
This file is included in the declaration of Eigen::MatrixBase, thanks to the preprocessor token EIGEN_MATRIX_PLUGIN. See: https://eigen.tuxfamily.org/dox/TopicCustomizing_Plugins.html and the file codac2_matrices.h
- Date
- 2024
- Author
- Simon Rohou
- Copyright
- Copyright 2023 Codac Team
- License: GNU Lesser General Public License (LGPL)
◆ operator()() [1/2]
template<int R = RowsAtCompileTime, int C = ColsAtCompileTime>
Scalar & operator() |
( |
Index | i, |
|
|
Index | j ) |
|
inline |
Accesses a matrix element (modifiable) by its row and column indices.
Provides mutable access to the element at the specified row i
and column j
. This operator allows both reading and writing of matrix elements.
- Parameters
-
i | Row index of the element. |
j | Column index of the element. |
- Returns
- Reference to the element at position (i,j).
28{
29 return const_cast<Scalar&
>(
static_cast<const Matrix<Scalar,R,C>&
>(*this).operator()(i,j));
30}
Matrix(const Matrix< double, R, C > &lb, const Matrix< double, R, C > &ub)
Constructs an interval matrix from lower and upper bound matrices.
Definition codac2_Matrix_addons_IntervalMatrixBase.h:50
◆ operator()() [2/2]
template<int R = RowsAtCompileTime, int C = ColsAtCompileTime>
const Scalar & operator() |
( |
Index | i, |
|
|
Index | j ) const |
|
inline |
Accesses a matrix element (non modifiable) by its row and column indices.
Provides reading access to the element at the specified row i
and column j
. This operator allows only reading of matrix elements.
- Parameters
-
i | Row index of the element. |
j | Column index of the element. |
- Returns
- Const reference to the element at position (i,j).
44{
45 assert_release(i >= 0 && i < this->rows() && j >= 0 && j < this->cols());
46
47 if constexpr(!IsVectorOrRow<R,C>)
49
50 else
51 {
52 if constexpr(R == 1)
53 return (*this)[j];
54 return (*this)[i];
55 }
56}
◆ init()
auto & init |
( |
const Scalar & | x | ) |
|
|
inline |
Initializes all elements of the matrix with the scalar value x
.
- Parameters
-
x | The scalar value to assign to each element. |
- Returns
- Reference to the current matrix object (allows method chaining).
65{
66 for(Index i = 0 ; i < this->size() ; i++)
67 *(this->data()+i) = x;
68 return *this;
69}
◆ operator==()
template<typename U_, int R_, int C_>
bool operator== |
( |
const Matrix< U_, R_, C_ > & | x | ) |
const |
|
inline |
Compares this matrix with another matrix for equality.
- Parameters
-
x | The other matrix to compare against. |
- Returns
true
if matrices have the same size, shape, and identical elements; false
otherwise.
79{
80
81
82
83
84
85
86 if(this->size() != x.size())
87 return false;
88
89 if constexpr(std::is_same_v<Scalar,codac2::Interval> && std::is_same_v<U_,codac2::Interval>)
90 {
92 return this->
is_empty() && x.is_empty();
93 }
94
95 if(this->rows() != x.rows() || this->cols() != x.cols())
96 return false;
97
98 for(Index i = 0 ; i < this->size() ; i++)
99 if(*(this->data()+i) != *(x.data()+i))
100 return false;
101
102 return true;
103}
bool is_empty() const
Checks whether the interval matrix is empty.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:56