ADD: added other eigen lib
This commit is contained in:
@@ -11,16 +11,18 @@
|
||||
#ifndef EIGEN_PARTIALLU_H
|
||||
#define EIGEN_PARTIALLU_H
|
||||
|
||||
#include "./InternalHeaderCheck.h"
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
namespace internal {
|
||||
template<typename _MatrixType> struct traits<PartialPivLU<_MatrixType> >
|
||||
: traits<_MatrixType>
|
||||
template<typename MatrixType_> struct traits<PartialPivLU<MatrixType_> >
|
||||
: traits<MatrixType_>
|
||||
{
|
||||
typedef MatrixXpr XprKind;
|
||||
typedef SolverStorage StorageKind;
|
||||
typedef int StorageIndex;
|
||||
typedef traits<_MatrixType> BaseTraits;
|
||||
typedef traits<MatrixType_> BaseTraits;
|
||||
enum {
|
||||
Flags = BaseTraits::Flags & RowMajorBit,
|
||||
CoeffReadCost = Dynamic
|
||||
@@ -46,7 +48,7 @@ struct enable_if_ref<Ref<T>,Derived> {
|
||||
*
|
||||
* \brief LU decomposition of a matrix with partial pivoting, and related features
|
||||
*
|
||||
* \tparam _MatrixType the type of the matrix of which we are computing the LU decomposition
|
||||
* \tparam MatrixType_ the type of the matrix of which we are computing the LU decomposition
|
||||
*
|
||||
* This class represents a LU decomposition of a \b square \b invertible matrix, with partial pivoting: the matrix A
|
||||
* is decomposed as A = PLU where L is unit-lower-triangular, U is upper-triangular, and P
|
||||
@@ -73,12 +75,12 @@ struct enable_if_ref<Ref<T>,Derived> {
|
||||
*
|
||||
* \sa MatrixBase::partialPivLu(), MatrixBase::determinant(), MatrixBase::inverse(), MatrixBase::computeInverse(), class FullPivLU
|
||||
*/
|
||||
template<typename _MatrixType> class PartialPivLU
|
||||
: public SolverBase<PartialPivLU<_MatrixType> >
|
||||
template<typename MatrixType_> class PartialPivLU
|
||||
: public SolverBase<PartialPivLU<MatrixType_> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef _MatrixType MatrixType;
|
||||
typedef MatrixType_ MatrixType;
|
||||
typedef SolverBase<PartialPivLU> Base;
|
||||
friend class SolverBase<PartialPivLU>;
|
||||
|
||||
@@ -265,10 +267,7 @@ template<typename _MatrixType> class PartialPivLU
|
||||
|
||||
protected:
|
||||
|
||||
static void check_template_parameters()
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||
}
|
||||
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
|
||||
|
||||
void compute();
|
||||
|
||||
@@ -334,12 +333,12 @@ namespace internal {
|
||||
template<typename Scalar, int StorageOrder, typename PivIndex, int SizeAtCompileTime=Dynamic>
|
||||
struct partial_lu_impl
|
||||
{
|
||||
static const int UnBlockedBound = 16;
|
||||
static const bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound;
|
||||
static const int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic;
|
||||
static constexpr int UnBlockedBound = 16;
|
||||
static constexpr bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound;
|
||||
static constexpr int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic;
|
||||
// Remaining rows and columns at compile-time:
|
||||
static const int RRows = SizeAtCompileTime==2 ? 1 : Dynamic;
|
||||
static const int RCols = SizeAtCompileTime==2 ? 1 : Dynamic;
|
||||
static constexpr int RRows = SizeAtCompileTime==2 ? 1 : Dynamic;
|
||||
static constexpr int RCols = SizeAtCompileTime==2 ? 1 : Dynamic;
|
||||
typedef Matrix<Scalar, ActualSizeAtCompileTime, ActualSizeAtCompileTime, StorageOrder> MatrixType;
|
||||
typedef Ref<MatrixType> MatrixTypeRef;
|
||||
typedef Ref<Matrix<Scalar, Dynamic, Dynamic, StorageOrder> > BlockType;
|
||||
@@ -379,7 +378,7 @@ struct partial_lu_impl
|
||||
|
||||
row_transpositions[k] = PivIndex(row_of_biggest_in_col);
|
||||
|
||||
if(biggest_in_corner != Score(0))
|
||||
if(!numext::is_exactly_zero(biggest_in_corner))
|
||||
{
|
||||
if(k != row_of_biggest_in_col)
|
||||
{
|
||||
@@ -405,7 +404,7 @@ struct partial_lu_impl
|
||||
{
|
||||
Index k = endk;
|
||||
row_transpositions[k] = PivIndex(k);
|
||||
if (Scoring()(lu(k, k)) == Score(0) && first_zero_pivot == -1)
|
||||
if (numext::is_exactly_zero(Scoring()(lu(k, k))) && first_zero_pivot == -1)
|
||||
first_zero_pivot = k;
|
||||
}
|
||||
|
||||
@@ -515,7 +514,7 @@ void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, t
|
||||
partial_lu_impl
|
||||
< typename MatrixType::Scalar, MatrixType::Flags&RowMajorBit?RowMajor:ColMajor,
|
||||
typename TranspositionType::StorageIndex,
|
||||
EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime)>
|
||||
internal::min_size_prefer_fixed(MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime)>
|
||||
::blocked_lu(lu.rows(), lu.cols(), &lu.coeffRef(0,0), lu.outerStride(), &row_transpositions.coeffRef(0), nb_transpositions);
|
||||
}
|
||||
|
||||
@@ -524,8 +523,6 @@ void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, t
|
||||
template<typename MatrixType>
|
||||
void PartialPivLU<MatrixType>::compute()
|
||||
{
|
||||
check_template_parameters();
|
||||
|
||||
// the row permutation is stored as int indices, so just to be sure:
|
||||
eigen_assert(m_lu.rows()<NumTraits<int>::highest());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user