Eigen  5.0.1-dev+master
 
Loading...
Searching...
No Matches
PartialPivLU.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
5// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
6//
7// This Source Code Form is subject to the terms of the Mozilla
8// Public License v. 2.0. If a copy of the MPL was not distributed
9// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10// SPDX-License-Identifier: MPL-2.0
11
12#ifndef EIGEN_PARTIALLU_H
13#define EIGEN_PARTIALLU_H
14
15// IWYU pragma: private
16#include "./InternalHeaderCheck.h"
17
18namespace Eigen {
19
20namespace internal {
21template <typename MatrixType_, typename PermutationIndex_>
22struct traits<PartialPivLU<MatrixType_, PermutationIndex_> > : traits<MatrixType_> {
23 using XprKind = MatrixXpr;
24 using StorageKind = SolverStorage;
25 using StorageIndex = PermutationIndex_;
26 using BaseTraits = traits<MatrixType_>;
27 enum { Flags = BaseTraits::Flags & RowMajorBit, CoeffReadCost = Dynamic };
28};
29
30} // end namespace internal
31
66template <typename MatrixType_, typename PermutationIndex_>
67class PartialPivLU : public SolverBase<PartialPivLU<MatrixType_, PermutationIndex_> > {
68 public:
69 using MatrixType = MatrixType_;
70 using Base = SolverBase<PartialPivLU>;
71 friend class SolverBase<PartialPivLU>;
72
73 EIGEN_GENERIC_PUBLIC_INTERFACE(PartialPivLU)
74 enum {
75 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
76 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
77 };
78 using PermutationIndex = PermutationIndex_;
81 using PlainObject = typename MatrixType::PlainObject;
82
90 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
91 return Success;
92 }
93
101
109
117 template <typename InputType>
118 explicit PartialPivLU(const EigenBase<InputType>& matrix);
119
127 template <typename InputType>
129
130 template <typename InputType>
131 PartialPivLU& compute(const EigenBase<InputType>& matrix) {
132 m_lu.resize(matrix.rows(), matrix.cols());
133 m_lu = matrix.derived();
134 compute();
135 return *this;
136 }
137
144 inline const MatrixType& matrixLU() const {
145 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
146 return m_lu;
147 }
148
151 inline const PermutationType& permutationP() const {
152 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
153 return m_p;
154 }
155
156#ifdef EIGEN_PARSED_BY_DOXYGEN
174 template <typename Rhs>
176#endif
177
181 inline RealScalar rcond() const {
182 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
183 return internal::rcond_estimate_helper(m_l1_norm, *this);
184 }
185
194 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
195 return Inverse<PartialPivLU>(*this);
196 }
197
214 Scalar determinant() const;
215
231 RealScalar absDeterminant() const;
232
245 RealScalar logAbsDeterminant() const;
246
259 Scalar signDeterminant() const;
260
261 MatrixType reconstructedMatrix() const;
262
263 constexpr Index rows() const noexcept { return m_lu.rows(); }
264 constexpr Index cols() const noexcept { return m_lu.cols(); }
265
266#ifndef EIGEN_PARSED_BY_DOXYGEN
267 template <typename RhsType, typename DstType>
268 EIGEN_DEVICE_FUNC void _solve_impl(const RhsType& rhs, DstType& dst) const {
269 /* The decomposition PA = LU can be rewritten as A = P^{-1} L U.
270 * So we proceed as follows:
271 * Step 1: compute c = Pb.
272 * Step 2: replace c by the solution x to Lx = c.
273 * Step 3: replace c by the solution x to Ux = c.
274 */
275
276 // Step 1
277 dst = permutationP() * rhs;
278
279 // Step 2
280 m_lu.template triangularView<UnitLower>().solveInPlace(dst);
281
282 // Step 3
283 m_lu.template triangularView<Upper>().solveInPlace(dst);
284 }
285
286 template <bool Conjugate, typename RhsType, typename DstType>
287 EIGEN_DEVICE_FUNC void _solve_impl_transposed(const RhsType& rhs, DstType& dst) const {
288 /* The decomposition PA = LU can be rewritten as A^T = U^T L^T P.
289 * So we proceed as follows:
290 * Step 1: compute c as the solution to L^T c = b
291 * Step 2: replace c by the solution x to U^T x = c.
292 * Step 3: update c = P^-1 c.
293 */
294
295 EIGEN_INTERNAL_ASSERT_SOLVER_RHS(m_lu, rhs, true);
296
297 // Step 1
298 dst = m_lu.template triangularView<Upper>().transpose().template conjugateIf<Conjugate>().solve(rhs);
299 // Step 2
300 m_lu.template triangularView<UnitLower>().transpose().template conjugateIf<Conjugate>().solveInPlace(dst);
301 // Step 3
302 dst = permutationP().transpose() * dst;
303 }
304#endif
305
306 protected:
307 EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
308
309 void compute();
310
311 MatrixType m_lu;
312 PermutationType m_p;
313 TranspositionType m_rowsTranspositions;
314 RealScalar m_l1_norm;
315 signed char m_det_p;
316 bool m_isInitialized;
317};
318
319template <typename MatrixType, typename PermutationIndex>
321 : m_lu(), m_p(), m_rowsTranspositions(), m_l1_norm(0), m_det_p(0), m_isInitialized(false) {}
322
323template <typename MatrixType, typename PermutationIndex>
325 : m_lu(size, size), m_p(size), m_rowsTranspositions(size), m_l1_norm(0), m_det_p(0), m_isInitialized(false) {}
326
327template <typename MatrixType, typename PermutationIndex>
328template <typename InputType>
330 : m_lu(matrix.rows(), matrix.cols()),
331 m_p(matrix.rows()),
332 m_rowsTranspositions(matrix.rows()),
333 m_l1_norm(0),
334 m_det_p(0),
335 m_isInitialized(false) {
336 compute(matrix.derived());
337}
338
339template <typename MatrixType, typename PermutationIndex>
340template <typename InputType>
342 : m_lu(matrix.derived()),
343 m_p(matrix.rows()),
344 m_rowsTranspositions(matrix.rows()),
345 m_l1_norm(0),
346 m_det_p(0),
347 m_isInitialized(false) {
348 compute();
349}
350
351namespace internal {
352
355template <int K, int Size, bool Last = (K == Size - 1)>
356struct unrolled_partial_lu_step {
357 template <typename MatrixTypeRef, typename PivIndex>
358 static EIGEN_STRONG_INLINE void run(MatrixTypeRef& lu, PivIndex* row_transpositions, PivIndex& nb_transpositions,
359 Index& first_zero_pivot) {
360 using Scalar = typename MatrixTypeRef::Scalar;
361 using Scoring = scalar_score_coeff_op<Scalar>;
362 using Score = typename Scoring::result_type;
363 constexpr int Remaining = Size - K - 1;
364
365 Index row_of_biggest_in_col;
366 const Score biggest_in_corner =
367 lu.col(K).template tail<Size - K>().unaryExpr(Scoring()).maxCoeff(&row_of_biggest_in_col);
368 row_of_biggest_in_col += K;
369 row_transpositions[K] = PivIndex(row_of_biggest_in_col);
370 if (!numext::is_exactly_zero(biggest_in_corner)) {
371 if (K != row_of_biggest_in_col) {
372 lu.row(K).swap(lu.row(row_of_biggest_in_col));
373 ++nb_transpositions;
374 }
375 lu.col(K).template tail<Remaining>() /= lu.coeff(K, K);
376 } else if (first_zero_pivot == -1) {
377 first_zero_pivot = K;
378 }
379 lu.template bottomRightCorner<Remaining, Remaining>().noalias() -=
380 lu.col(K).template tail<Remaining>() * lu.row(K).template tail<Remaining>();
381 unrolled_partial_lu_step<K + 1, Size>::run(lu, row_transpositions, nb_transpositions, first_zero_pivot);
382 }
383};
384
385template <int K, int Size>
386struct unrolled_partial_lu_step<K, Size, /*Last=*/true> {
387 template <typename MatrixTypeRef, typename PivIndex>
388 static EIGEN_STRONG_INLINE void run(MatrixTypeRef& lu, PivIndex* row_transpositions, PivIndex&,
389 Index& first_zero_pivot) {
390 using Scoring = scalar_score_coeff_op<typename MatrixTypeRef::Scalar>;
391 row_transpositions[K] = PivIndex(K);
392 if (numext::is_exactly_zero(Scoring()(lu.coeff(K, K))) && first_zero_pivot == -1) first_zero_pivot = K;
393 }
394};
395
397template <bool Unroll, int Size>
398struct unrolled_partial_lu {
399 template <typename MatrixTypeRef, typename PivIndex>
400 static EIGEN_STRONG_INLINE bool run(MatrixTypeRef&, PivIndex*, PivIndex&, Index&) {
401 return false;
402 }
403};
404
405template <int Size>
406struct unrolled_partial_lu<true, Size> {
407 template <typename MatrixTypeRef, typename PivIndex>
408 static EIGEN_STRONG_INLINE bool run(MatrixTypeRef& lu, PivIndex* row_transpositions, PivIndex& nb_transpositions,
409 Index& first_zero_pivot) {
410 nb_transpositions = 0;
411 first_zero_pivot = -1;
412 unrolled_partial_lu_step<0, Size>::run(lu, row_transpositions, nb_transpositions, first_zero_pivot);
413 return true;
414 }
415};
416
418template <typename Scalar, int StorageOrder, typename PivIndex, int SizeAtCompileTime = Dynamic>
419struct generic_partial_lu_impl {
420 static constexpr int UnBlockedBound = 16;
421 static constexpr bool UnBlockedAtCompileTime = SizeAtCompileTime != Dynamic && SizeAtCompileTime <= UnBlockedBound;
422 static constexpr int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic;
423 // Unrolling gives the pivot search, scaling and update of every step compile-time extents; runtime-sized blocks'
424 // vectorized loops cost more than their arithmetic (1.5-4.6x for 3x3 to 6x6 double, gcc and clang, AVX2). At 16,
425 // gcc's unrolled code is slower than the loop.
426 static constexpr int UnrolledBound = 12;
427 static constexpr bool UnrolledAtCompileTime = UnBlockedAtCompileTime && SizeAtCompileTime <= UnrolledBound;
428 // Remaining rows and columns at compile-time:
429 static constexpr int RRows = SizeAtCompileTime == 2 ? 1 : Dynamic;
430 static constexpr int RCols = SizeAtCompileTime == 2 ? 1 : Dynamic;
431 using MatrixType = Matrix<Scalar, ActualSizeAtCompileTime, ActualSizeAtCompileTime, StorageOrder>;
432 using MatrixTypeRef = Ref<MatrixType>;
433 using BlockType = Ref<Matrix<Scalar, Dynamic, Dynamic, StorageOrder>>;
434 using RealScalar = typename MatrixType::RealScalar;
435
436 static void apply_row_transpositions(BlockType& matrix, Index first, Index count, const PivIndex* transpositions) {
437 EIGEN_IF_CONSTEXPR (StorageOrder == ColMajor) {
438 // Keep the pivot rows of one column in cache, even when the outer stride maps every column to the same set.
439 for (Index j = 0; j < matrix.cols(); ++j)
440 for (Index i = first; i < first + count; ++i)
441 numext::swap(matrix.coeffRef(i, j), matrix.coeffRef(transpositions[i], j));
442 } else {
443 for (Index i = first; i < first + count; ++i) matrix.row(i).swap(matrix.row(transpositions[i]));
444 }
445 }
446
457 static Index unblocked_lu(MatrixTypeRef& lu, PivIndex* row_transpositions, PivIndex& nb_transpositions) {
458 using Scoring = scalar_score_coeff_op<Scalar>;
459 using Score = typename Scoring::result_type;
460 {
461 Index first_zero_pivot;
462 if (unrolled_partial_lu<UnrolledAtCompileTime, SizeAtCompileTime>::run(lu, row_transpositions, nb_transpositions,
463 first_zero_pivot))
464 return first_zero_pivot;
465 }
466 const Index rows = lu.rows();
467 const Index cols = lu.cols();
468 const Index size = (std::min)(rows, cols);
469 // For small compile-time matrices and square runtime matrices it is worth processing the last row separately:
470 // speedup: +100% for 2x2, +10% for others.
471 const bool process_last_row_separately = UnBlockedAtCompileTime || rows == cols;
472 const Index endk = process_last_row_separately ? size - 1 : size;
473 nb_transpositions = 0;
474 Index first_zero_pivot = -1;
475 for (Index k = 0; k < endk; ++k) {
476 int rrows = internal::convert_index<int>(rows - k - 1);
477 int rcols = internal::convert_index<int>(cols - k - 1);
478
479 Index row_of_biggest_in_col;
480 Score biggest_in_corner = lu.col(k).tail(rows - k).unaryExpr(Scoring()).maxCoeff(&row_of_biggest_in_col);
481 row_of_biggest_in_col += k;
482
483 row_transpositions[k] = PivIndex(row_of_biggest_in_col);
484
485 if (!numext::is_exactly_zero(biggest_in_corner)) {
486 if (k != row_of_biggest_in_col) {
487 lu.row(k).swap(lu.row(row_of_biggest_in_col));
488 ++nb_transpositions;
489 }
490
491 lu.col(k).tail(fix<RRows>(rrows)) /= lu.coeff(k, k);
492 } else if (first_zero_pivot == -1) {
493 // the pivot is exactly zero, we record the index of the first pivot which is exactly 0,
494 // and continue the factorization such we still have P A = L U
495 first_zero_pivot = k;
496 }
497
498 // Skip the trailing update for rectangular panels with no remaining columns.
499 if (rrows > 0 && rcols > 0)
500 lu.bottomRightCorner(fix<RRows>(rrows), fix<RCols>(rcols)).noalias() -=
501 lu.col(k).tail(fix<RRows>(rrows)) * lu.row(k).tail(fix<RCols>(rcols));
502 }
503
504 // special handling of the last entry
505 if (process_last_row_separately) {
506 Index k = endk;
507 row_transpositions[k] = PivIndex(k);
508 if (numext::is_exactly_zero(Scoring()(lu(k, k))) && first_zero_pivot == -1) first_zero_pivot = k;
509 }
510
511 return first_zero_pivot;
512 }
513
529 static Index blocked_lu(Index rows, Index cols, Scalar* lu_data, Index luStride, PivIndex* row_transpositions,
530 PivIndex& nb_transpositions, Index maxBlockSize = 256) {
531 MatrixTypeRef lu = MatrixType::Map(lu_data, rows, cols, OuterStride<>(luStride));
532
533 const Index size = (std::min)(rows, cols);
534
535 // if the matrix is too small, no blocking:
536 EIGEN_IF_CONSTEXPR (UnBlockedAtCompileTime) {
537 return unblocked_lu(lu, row_transpositions, nb_transpositions);
538 } else if (size <= UnBlockedBound) {
539 return unblocked_lu(lu, row_transpositions, nb_transpositions);
540 }
541
542 // automatically adjust the number of subdivisions to the size
543 // of the matrix so that there is enough sub blocks:
544 Index blockSize;
545 {
546 blockSize = size / 8;
547 blockSize = (blockSize / 16) * 16;
548 blockSize = (std::min)((std::max)(blockSize, Index(8)), maxBlockSize);
549 }
550
551 nb_transpositions = 0;
552 Index first_zero_pivot = -1;
553 for (Index k = 0; k < size; k += blockSize) {
554 Index bs = (std::min)(size - k, blockSize); // actual size of the block
555 Index trows = rows - k - bs; // trailing rows
556 Index tsize = cols - k - bs; // trailing columns
557
558 // partition the matrix:
559 // A00 | A01 | A02
560 // lu = A_0 | A_1 | A_2 = A10 | A11 | A12
561 // A20 | A21 | A22
562 BlockType A_2 = lu.block(0, k + bs, rows, tsize);
563 BlockType A11 = lu.block(k, k, bs, bs);
564 BlockType A12 = lu.block(k, k + bs, bs, tsize);
565 BlockType A21 = lu.block(k + bs, k, trows, bs);
566 BlockType A22 = lu.block(k + bs, k + bs, trows, tsize);
567
568 PivIndex nb_transpositions_in_panel;
569 // recursively call the blocked LU algorithm on [A11^T A21^T]^T
570 // with a very small blocking size:
571 Index ret = blocked_lu(trows + bs, bs, &lu.coeffRef(k, k), luStride, row_transpositions + k,
572 nb_transpositions_in_panel, 16);
573 if (ret >= 0 && first_zero_pivot == -1) first_zero_pivot = k + ret;
574
575 nb_transpositions += nb_transpositions_in_panel;
576 // update permutations and apply them to A_0
577 if (k > 0) {
578 BlockType A_0 = lu.block(0, 0, rows, k);
579 for (Index i = k; i < k + bs; ++i) row_transpositions[i] += internal::convert_index<PivIndex>(k);
580 apply_row_transpositions(A_0, k, bs, row_transpositions);
581 }
582
583 if (tsize) {
584 // apply permutations to A_2
585 apply_row_transpositions(A_2, k, bs, row_transpositions);
586
587 // A12 = A11^-1 A12
588 A11.template triangularView<UnitLower>().solveInPlace(A12);
589
590 A22.noalias() -= A21 * A12;
591 }
592 }
593 return first_zero_pivot;
594 }
595};
596
597template <typename Scalar, int StorageOrder, typename PivIndex, int SizeAtCompileTime = Dynamic>
598struct partial_lu_impl : generic_partial_lu_impl<Scalar, StorageOrder, PivIndex, SizeAtCompileTime> {};
599
602template <typename MatrixType, typename TranspositionType>
603void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions,
604 typename TranspositionType::StorageIndex& nb_transpositions) {
605 // Special-case of zero matrix.
606 if (lu.rows() == 0 || lu.cols() == 0) {
607 nb_transpositions = 0;
608 return;
609 }
610 EIGEN_INTERNAL_ASSERT_SIZE_MATCHES_COLS(row_transpositions.indices(), lu);
611 eigen_assert(row_transpositions.size() < 2 ||
612 (&row_transpositions.coeffRef(1) - &row_transpositions.coeffRef(0)) == 1);
613
614 if (EIGEN_PREDICT_FALSE(MatrixType::InnerStrideAtCompileTime != 1 && lu.innerStride() != 1)) {
615 // blocked_lu addresses the matrix by pointer and outer stride only: factor a contiguous copy.
616 typename plain_matrix_type<MatrixType>::type contiguous = lu;
617 partial_lu_inplace(contiguous, row_transpositions, nb_transpositions);
618 lu = contiguous;
619 return;
620 }
621
622 partial_lu_impl<typename MatrixType::Scalar, MatrixType::Flags & RowMajorBit ? RowMajor : ColMajor,
623 typename TranspositionType::StorageIndex,
624 internal::min_size_prefer_fixed(MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime)>::
625 blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0, 0), lu.outerStride(), &row_transpositions.coeffRef(0),
626 nb_transpositions);
627}
628
632template <typename Derived>
633typename traits<Derived>::Scalar partial_lu_determinant(const Derived& m) {
634 using Scalar = typename traits<Derived>::Scalar;
635 if (m.rows() == 0) return Scalar(1);
636 EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
637
638 using PlainObject = typename plain_matrix_type<Derived>::type;
639 using TranspositionType =
640 Transpositions<PlainObject::RowsAtCompileTime, PlainObject::MaxRowsAtCompileTime, DefaultPermutationIndex>;
641
642 eigen_assert(m.rows() < NumTraits<DefaultPermutationIndex>::highest());
643 PlainObject lu(m);
644
645 TranspositionType row_transpositions(lu.rows());
646 typename TranspositionType::StorageIndex nb_transpositions;
647 partial_lu_inplace(lu, row_transpositions, nb_transpositions);
648
649 return Scalar((nb_transpositions % 2) ? -1 : 1) * internal::scaled_prod(lu.diagonal()).value();
650}
651
652} // end namespace internal
653
654template <typename MatrixType, typename PermutationIndex>
655void PartialPivLU<MatrixType, PermutationIndex>::compute() {
656 eigen_assert(m_lu.rows() < NumTraits<PermutationIndex>::highest());
657
658 if (m_lu.cols() > 0)
659 m_l1_norm = m_lu.cwiseAbs().colwise().sum().maxCoeff();
660 else
661 m_l1_norm = RealScalar(0);
662
663 EIGEN_INTERNAL_ASSERT_SQUARE_MSG(m_lu, "PartialPivLU is only for square (and moreover invertible) matrices");
664 const Index size = m_lu.rows();
665
666 m_rowsTranspositions.resize(size);
667
668 typename TranspositionType::StorageIndex nb_transpositions;
669 internal::partial_lu_inplace(m_lu, m_rowsTranspositions, nb_transpositions);
670 m_det_p = (nb_transpositions % 2) ? -1 : 1;
671
672 m_p = m_rowsTranspositions;
673
674 m_isInitialized = true;
675}
676
677template <typename MatrixType, typename PermutationIndex>
678typename PartialPivLU<MatrixType, PermutationIndex>::Scalar PartialPivLU<MatrixType, PermutationIndex>::determinant()
679 const {
680 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
681 return Scalar(m_det_p) * internal::scaled_prod(m_lu.diagonal()).value();
682}
683
684template <typename MatrixType, typename PermutationIndex>
687 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
688 return internal::scaled_prod(m_lu.diagonal()).abs();
689}
690
691template <typename MatrixType, typename PermutationIndex>
694 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
695 return internal::log_abs_prod(m_lu.diagonal());
696}
697
698template <typename MatrixType, typename PermutationIndex>
699typename PartialPivLU<MatrixType, PermutationIndex>::Scalar
701 eigen_assert(m_isInitialized && "PartialPivLU is not initialized.");
702 return Scalar(m_det_p) * m_lu.diagonal().array().sign().prod();
703}
704
708template <typename MatrixType, typename PermutationIndex>
710 eigen_assert(m_isInitialized && "LU is not initialized.");
711 // LU
712 MatrixType res = m_lu.template triangularView<UnitLower>().toDenseMatrix() * m_lu.template triangularView<Upper>();
713
714 // P^{-1}(LU)
715 res = m_p.inverse() * res;
716
717 return res;
718}
719
720/***** Implementation details *****************************************************/
721
722namespace internal {
723
724/***** Implementation of inverse() *****************************************************/
725template <typename DstXprType, typename MatrixType, typename PermutationIndex>
726struct Assignment<
727 DstXprType, Inverse<PartialPivLU<MatrixType, PermutationIndex> >,
728 internal::assign_op<typename DstXprType::Scalar, typename PartialPivLU<MatrixType, PermutationIndex>::Scalar>,
729 Dense2Dense> {
731 using SrcXprType = Inverse<LuType>;
732 static void run(DstXprType& dst, const SrcXprType& src,
733 const internal::assign_op<typename DstXprType::Scalar, typename LuType::Scalar>&) {
734 dst = src.nestedExpression().solve(MatrixType::Identity(src.rows(), src.cols()));
735 }
736};
737} // end namespace internal
738
739/******** MatrixBase methods *******/
740
747template <typename Derived>
748template <typename PermutationIndex>
749inline PartialPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex> MatrixBase<Derived>::partialPivLu()
750 const {
752}
753
762template <typename Derived>
763template <typename PermutationIndex>
764inline PartialPivLU<typename MatrixBase<Derived>::PlainObject, PermutationIndex> MatrixBase<Derived>::lu() const {
766}
767
768} // end namespace Eigen
769
770#endif // EIGEN_PARTIALLU_H
EvalReturnType eval() const
Definition DenseBase.h:389
Expression of the inverse of another expression.
Definition Inverse.h:44
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:53
LU decomposition of a matrix with partial pivoting, and related features.
Definition PartialPivLU.h:67
PartialPivLU(Index size)
Default Constructor with memory preallocation.
Definition PartialPivLU.h:324
RealScalar logAbsDeterminant() const
Definition PartialPivLU.h:693
Solve< PartialPivLU, Rhs > solve(const MatrixBase< Rhs > &b) const
MatrixType reconstructedMatrix() const
Definition PartialPivLU.h:709
Scalar signDeterminant() const
Definition PartialPivLU.h:700
const MatrixType & matrixLU() const
Definition PartialPivLU.h:144
ComputationInfo info() const
Reports whether the LU factorization was successful.
Definition PartialPivLU.h:89
RealScalar rcond() const
Definition PartialPivLU.h:181
PartialPivLU(const EigenBase< InputType > &matrix)
Definition PartialPivLU.h:329
PartialPivLU()
Default Constructor.
Definition PartialPivLU.h:320
const PermutationType & permutationP() const
Definition PartialPivLU.h:151
PartialPivLU(EigenBase< InputType > &matrix)
Definition PartialPivLU.h:341
Inverse< PartialPivLU > inverse() const
Definition PartialPivLU.h:193
Scalar determinant() const
Definition PartialPivLU.h:678
RealScalar absDeterminant() const
Definition PartialPivLU.h:686
InverseReturnType transpose() const
Definition PermutationMatrix.h:234
Permutation matrix.
Definition PermutationMatrix.h:346
Pseudo expression representing a solving operation.
Definition Solve.h:63
constexpr PartialPivLU< MatrixType_, PermutationIndex_ > & derived()
Represents a sequence of transpositions (row/column interchange)
Definition Transpositions.h:144
static const auto fix()
ComputationInfo
Definition Constants.h:455
@ Success
Definition Constants.h:457
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
constexpr unsigned int RowMajorBit
Definition Constants.h:71
Definition EigenBase.h:34
constexpr Index cols() const noexcept
Definition EigenBase.h:62
constexpr Derived & derived()
Definition EigenBase.h:50
constexpr Index rows() const noexcept
Definition EigenBase.h:60
constexpr Index size() const noexcept
Definition EigenBase.h:65
Eigen::Index Index
The interface type of indices.
Definition EigenBase.h:44