codac 2.0.0
Loading...
Searching...
No Matches
codac2_IntvFullPivLU.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <ostream>
13#include "codac2_Matrix.h"
14#include "codac2_Row.h"
16#include "codac2_BoolInterval.h"
17
18namespace codac2
19{
31 {
32 public:
33
39 explicit IntvFullPivLU(const Matrix& M);
40
47 explicit IntvFullPivLU(const IntervalMatrix& M);
48
56
64
72
81
92 Interval rank() const;
93
103
114
125
138 template<typename Derived>
139 Derived image(const Eigen::MatrixBase<Derived> &M) const;
140
153 template<typename Derived>
154 Derived coimage(const Eigen::MatrixBase<Derived> &M) const;
155
181
209 void solve(const IntervalMatrix& rhs, IntervalMatrix& B) const;
210
220
226 double max_pivot() const;
227
234 const Eigen::FullPivLU<Matrix>::PermutationPType& permutation_P() const;
235
242 const Eigen::FullPivLU<Matrix>::PermutationQType& permutation_Q() const;
243
249 const Eigen::FullPivLU<Matrix>& eigen_LU() const;
250
257 const Row& transformation() const;
258
265 const IntervalMatrix& matrix_LU() const;
266
267
268 private:
269
270 Eigen::FullPivLU<Matrix> _LU;
271 Row transform;
272 IntervalMatrix matrixLU_;
273
274 void compute_matrix_LU(const IntervalMatrix& M, double nonzero);
275 static IntervalMatrix build_LU_bounds(const IntervalMatrix& E);
276 };
277
279 return this->matrixLU_;
280}
281inline const Eigen::FullPivLU<Matrix>::PermutationPType
283 return this->_LU.permutationP();
284}
285inline const Eigen::FullPivLU<Matrix>::PermutationQType
287 return this->_LU.permutationQ();
288}
289inline const Eigen::FullPivLU<Matrix> &IntvFullPivLU::eigen_LU() const {
290 return this->_LU;
291}
292inline const Row &IntvFullPivLU::transformation() const {
293 return this->transform;
294}
295
296template<typename Derived>
298 (const Eigen::MatrixBase<Derived> &M) const
299{
300 int rk = this->rank().lb();
301 if (rk==0) {
302 return Derived::Zero(M.rows(),1);
303 /* NdDamien : où est-ce qu'on dit que Derived est une
304 matrice ??? je crois que je hais le C++ ;) */
305 }
306 Derived ret =
307 Derived::Zero(M.rows(),rk);
308 Index p = 0;
309 Index dim = std::min(matrixLU_.rows(),matrixLU_.cols());
310 auto Q = this->_LU.permutationQ();
311 for (Index i = 0; i<dim; i++) {
312 if (!matrixLU_(i,i).contains(0.0)) {
313 ret.col(p) = M.col(Q.indices().coeff(i));
314 p++;
315 }
316 }
317 return ret;
318}
319
320template<typename Derived>
322 (const Eigen::MatrixBase<Derived> &M) const
323{
324 int rk = this->rank().lb();
325 if (rk==0) {
326 return Derived::Zero(1,M.cols());
327 }
328 Derived ret =
329 Derived::Zero(rk,M.cols());
330 Index p = 0;
331 Index dim = std::min(matrixLU_.rows(),matrixLU_.cols());
332 auto P = this->_LU.permutationP();
333 for (Index i = 0; i<dim; i++) {
334 if (!matrixLU_(i,i).contains(0.0)) {
335 ret.row(p) = M.row(P.indices().coeff(i));
336 p++;
337 }
338 }
339 return ret;
340}
341
342}
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:49
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:110
Interval rank() const
Return an interval enclosing the rank. Quite precise for square matrix (number of diagonal elements o...
BoolInterval is_invertible() const
Check if the initial matrix is invertible i.e. it is square and full rank.
IntvFullPivLU(const Matrix &M)
Constructor from Matrix of double.
const Eigen::FullPivLU< Matrix >::PermutationPType & permutation_P() const
The permutation in the decomposition .
Definition codac2_IntvFullPivLU.h:282
IntervalMatrix cokernel() const
Overapproximation of the left-null ("cokernel") space as a matrix of row vectors. Any vector which i...
IntervalMatrix kernel() const
Overapproximation of the kernel space as a matrix of column vectors. Any vector which is not a linea...
Interval dimension_of_kernel() const
Approximation of the size of the kernel space, based on the result of rank() (number of cols-rank())....
const Eigen::FullPivLU< Matrix >::PermutationQType & permutation_Q() const
The permutation in the decomposition .
Definition codac2_IntvFullPivLU.h:286
BoolInterval is_injective() const
Check if the matrix is injective, i.e. its rank is equal to its number of rows.
IntvFullPivLU(const IntervalMatrix &M)
Constructor from Matrix of intervals. Eigen decomposition is done on M.mid().
Interval determinant() const
Return an interval enclosing the determinant.
IntervalMatrix solve(const IntervalMatrix &rhs) const
Equation solving .
BoolInterval is_surjective() const
Check if the matrix is surjective i.e. its rank is equal to its number of cols.
IntervalMatrix reconstructed_matrix() const
Rebuilding of the matrix, i.e. compute .
Derived coimage(const Eigen::MatrixBase< Derived > &M) const
"Underapproximation" of the row space of the matrix, i.e. return a set of independant rows of the ori...
Definition codac2_IntvFullPivLU.h:322
const Eigen::FullPivLU< Matrix > & eigen_LU() const
The Eigen decomposition of M.mid()
Definition codac2_IntvFullPivLU.h:289
const IntervalMatrix & matrix_LU() const
Returns the matrix storing and (i.e. for strictly lower part, for upper part).
Definition codac2_IntvFullPivLU.h:278
void solve(const IntervalMatrix &rhs, IntervalMatrix &B) const
Equation solving with bounding matrix for the solution, i.e. contraction of the matrix on the solut...
Derived image(const Eigen::MatrixBase< Derived > &M) const
"Underapproximation" of the column space of the matrix, i.e. return a set of independant columns of t...
Definition codac2_IntvFullPivLU.h:298
double max_pivot() const
Maximum magnitude of the diagonal elements of .
const Row & transformation() const
Return the column-wise transformation done on M.mid() before the Eigen LU decomposition,...
Definition codac2_IntvFullPivLU.h:292
bool contains(const Matrix< double, RowsAtCompileTime, ColsAtCompileTime > &x) const
Checks if this interval matrix contains the specified matrix x.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:382
Definition codac2_OctaSym.h:21
Eigen::Matrix< double, 1,-1 > Row
Alias for a dynamically-sized row vector of doubles.
Definition codac2_Row.h:24
BoolInterval
Enumeration representing a boolean interval.
Definition codac2_BoolInterval.h:26
Eigen::Matrix< double,-1,-1 > Matrix
Alias for a dynamic-size matrix of doubles.
Definition codac2_Matrix.h:26
Eigen::Matrix< Interval,-1,-1 > IntervalMatrix
Alias for a dynamic-size matrix of intervals.
Definition codac2_IntervalMatrix.h:25