MOAB  4.9.3pre
Eigen::SuperLUBase< _MatrixType, Derived > Class Template Reference

The base class for the direct and incomplete LU factorization of SuperLU. More...

#include <SuperLUSupport.h>

Inheritance diagram for Eigen::SuperLUBase< _MatrixType, Derived >:
Collaboration diagram for Eigen::SuperLUBase< _MatrixType, Derived >:

List of all members.

Public Types

enum  { ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }
typedef _MatrixType MatrixType
typedef MatrixType::Scalar Scalar
typedef MatrixType::RealScalar RealScalar
typedef MatrixType::StorageIndex StorageIndex
typedef Matrix< Scalar,
Dynamic, 1 > 
Vector
typedef Matrix< int,
1, MatrixType::ColsAtCompileTime > 
IntRowVectorType
typedef Matrix< int,
MatrixType::RowsAtCompileTime, 1 > 
IntColVectorType
typedef Map< PermutationMatrix
< Dynamic, Dynamic, int > > 
PermutationMap
typedef SparseMatrix< ScalarLUMatrixType

Public Member Functions

 SuperLUBase ()
 ~SuperLUBase ()
Index rows () const
Index cols () const
superlu_options_t & options ()
ComputationInfo info () const
 Reports whether previous computation was successful.
void compute (const MatrixType &matrix)
void analyzePattern (const MatrixType &)
template<typename Stream >
void dumpMemory (Stream &)

Protected Types

typedef SparseSolverBase< Derived > Base

Protected Member Functions

void initFactorization (const MatrixType &a)
void init ()
void extractData () const
void clearFactors ()

Protected Attributes

LUMatrixType m_l
LUMatrixType m_u
IntColVectorType m_p
IntRowVectorType m_q
LUMatrixType m_matrix
SluMatrix m_sluA
SuperMatrix m_sluL
SuperMatrix m_sluU
SluMatrix m_sluB
SluMatrix m_sluX
SuperLUStat_t m_sluStat
superlu_options_t m_sluOptions
std::vector< int > m_sluEtree
Matrix< RealScalar, Dynamic, 1 > m_sluRscale
Matrix< RealScalar, Dynamic, 1 > m_sluCscale
Matrix< RealScalar, Dynamic, 1 > m_sluFerr
Matrix< RealScalar, Dynamic, 1 > m_sluBerr
char m_sluEqued
ComputationInfo m_info
int m_factorizationIsOk
int m_analysisIsOk
bool m_extractedDataAreDirty

Private Member Functions

 SuperLUBase (SuperLUBase &)

Detailed Description

template<typename _MatrixType, typename Derived>
class Eigen::SuperLUBase< _MatrixType, Derived >

The base class for the direct and incomplete LU factorization of SuperLU.

Definition at line 291 of file SuperLUSupport.h.


Member Typedef Documentation

template<typename _MatrixType, typename Derived>
typedef SparseSolverBase<Derived> Eigen::SuperLUBase< _MatrixType, Derived >::Base [protected]

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 294 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> Eigen::SuperLUBase< _MatrixType, Derived >::IntColVectorType

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 304 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> Eigen::SuperLUBase< _MatrixType, Derived >::IntRowVectorType

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 303 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef SparseMatrix<Scalar> Eigen::SuperLUBase< _MatrixType, Derived >::LUMatrixType

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 306 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef _MatrixType Eigen::SuperLUBase< _MatrixType, Derived >::MatrixType

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 298 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef Map<PermutationMatrix<Dynamic,Dynamic,int> > Eigen::SuperLUBase< _MatrixType, Derived >::PermutationMap

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 305 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef MatrixType::RealScalar Eigen::SuperLUBase< _MatrixType, Derived >::RealScalar

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 300 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef MatrixType::Scalar Eigen::SuperLUBase< _MatrixType, Derived >::Scalar

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 299 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef MatrixType::StorageIndex Eigen::SuperLUBase< _MatrixType, Derived >::StorageIndex

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 301 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
typedef Matrix<Scalar,Dynamic,1> Eigen::SuperLUBase< _MatrixType, Derived >::Vector

Definition at line 302 of file SuperLUSupport.h.


Member Enumeration Documentation

template<typename _MatrixType, typename Derived>
anonymous enum
Enumerator:
ColsAtCompileTime 
MaxColsAtCompileTime 

Definition at line 307 of file SuperLUSupport.h.

         {
      ColsAtCompileTime = MatrixType::ColsAtCompileTime,
      MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
    };

Constructor & Destructor Documentation

template<typename _MatrixType, typename Derived>
Eigen::SuperLUBase< _MatrixType, Derived >::SuperLUBase ( ) [inline]

Definition at line 314 of file SuperLUSupport.h.

{}
template<typename _MatrixType, typename Derived>
Eigen::SuperLUBase< _MatrixType, Derived >::~SuperLUBase ( ) [inline]

Definition at line 316 of file SuperLUSupport.h.

    {
      clearFactors();
    }
template<typename _MatrixType, typename Derived>
Eigen::SuperLUBase< _MatrixType, Derived >::SuperLUBase ( SuperLUBase< _MatrixType, Derived > &  ) [inline, private]

Definition at line 441 of file SuperLUSupport.h.

{ }

Member Function Documentation

template<typename _MatrixType, typename Derived>
void Eigen::SuperLUBase< _MatrixType, Derived >::analyzePattern ( const MatrixType ) [inline]

Performs a symbolic decomposition on the sparcity of matrix.

This function is particularly useful when solving for several problems having the same structure.

See also:
factorize()

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 351 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
void Eigen::SuperLUBase< _MatrixType, Derived >::clearFactors ( ) [inline, protected]

Definition at line 404 of file SuperLUSupport.h.

    {
      if(m_sluL.Store)
        Destroy_SuperNode_Matrix(&m_sluL);
      if(m_sluU.Store)
        Destroy_CompCol_Matrix(&m_sluU);

      m_sluL.Store = 0;
      m_sluU.Store = 0;

      memset(&m_sluL,0,sizeof m_sluL);
      memset(&m_sluU,0,sizeof m_sluU);
    }
template<typename _MatrixType, typename Derived>
Index Eigen::SuperLUBase< _MatrixType, Derived >::cols ( void  ) const [inline]

Definition at line 322 of file SuperLUSupport.h.

{ return m_matrix.cols(); }
template<typename _MatrixType, typename Derived>
void Eigen::SuperLUBase< _MatrixType, Derived >::compute ( const MatrixType matrix) [inline]

Computes the sparse Cholesky decomposition of matrix

Definition at line 339 of file SuperLUSupport.h.

    {
      derived().analyzePattern(matrix);
      derived().factorize(matrix);
    }
template<typename _MatrixType, typename Derived>
template<typename Stream >
void Eigen::SuperLUBase< _MatrixType, Derived >::dumpMemory ( Stream &  ) [inline]

Definition at line 360 of file SuperLUSupport.h.

    {}
template<typename MatrixType , typename Derived >
void Eigen::SuperLUBase< MatrixType, Derived >::extractData ( ) const [protected]

Definition at line 681 of file SuperLUSupport.h.

{
  eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for extracting factors, you must first call either compute() or analyzePattern()/factorize()");
  if (m_extractedDataAreDirty)
  {
    int         upper;
    int         fsupc, istart, nsupr;
    int         lastl = 0, lastu = 0;
    SCformat    *Lstore = static_cast<SCformat*>(m_sluL.Store);
    NCformat    *Ustore = static_cast<NCformat*>(m_sluU.Store);
    Scalar      *SNptr;

    const Index size = m_matrix.rows();
    m_l.resize(size,size);
    m_l.resizeNonZeros(Lstore->nnz);
    m_u.resize(size,size);
    m_u.resizeNonZeros(Ustore->nnz);

    int* Lcol = m_l.outerIndexPtr();
    int* Lrow = m_l.innerIndexPtr();
    Scalar* Lval = m_l.valuePtr();

    int* Ucol = m_u.outerIndexPtr();
    int* Urow = m_u.innerIndexPtr();
    Scalar* Uval = m_u.valuePtr();

    Ucol[0] = 0;
    Ucol[0] = 0;

    /* for each supernode */
    for (int k = 0; k <= Lstore->nsuper; ++k)
    {
      fsupc   = L_FST_SUPC(k);
      istart  = L_SUB_START(fsupc);
      nsupr   = L_SUB_START(fsupc+1) - istart;
      upper   = 1;

      /* for each column in the supernode */
      for (int j = fsupc; j < L_FST_SUPC(k+1); ++j)
      {
        SNptr = &((Scalar*)Lstore->nzval)[L_NZ_START(j)];

        /* Extract U */
        for (int i = U_NZ_START(j); i < U_NZ_START(j+1); ++i)
        {
          Uval[lastu] = ((Scalar*)Ustore->nzval)[i];
          /* Matlab doesn't like explicit zero. */
          if (Uval[lastu] != 0.0)
            Urow[lastu++] = U_SUB(i);
        }
        for (int i = 0; i < upper; ++i)
        {
          /* upper triangle in the supernode */
          Uval[lastu] = SNptr[i];
          /* Matlab doesn't like explicit zero. */
          if (Uval[lastu] != 0.0)
            Urow[lastu++] = L_SUB(istart+i);
        }
        Ucol[j+1] = lastu;

        /* Extract L */
        Lval[lastl] = 1.0; /* unit diagonal */
        Lrow[lastl++] = L_SUB(istart + upper - 1);
        for (int i = upper; i < nsupr; ++i)
        {
          Lval[lastl] = SNptr[i];
          /* Matlab doesn't like explicit zero. */
          if (Lval[lastl] != 0.0)
            Lrow[lastl++] = L_SUB(istart+i);
        }
        Lcol[j+1] = lastl;

        ++upper;
      } /* for j ... */

    } /* for k ... */

    // squeeze the matrices :
    m_l.resizeNonZeros(lastl);
    m_u.resizeNonZeros(lastu);

    m_extractedDataAreDirty = false;
  }
}
template<typename _MatrixType, typename Derived>
ComputationInfo Eigen::SuperLUBase< _MatrixType, Derived >::info ( ) const [inline]

Reports whether previous computation was successful.

Returns:
Success if computation was succesful, NumericalIssue if the matrix.appears to be negative.

Definition at line 332 of file SuperLUSupport.h.

    {
      eigen_assert(m_isInitialized && "Decomposition is not initialized.");
      return m_info;
    }
template<typename _MatrixType, typename Derived>
void Eigen::SuperLUBase< _MatrixType, Derived >::init ( ) [inline, protected]

Reimplemented in Eigen::SuperLU< _MatrixType >.

Definition at line 394 of file SuperLUSupport.h.

    {
      m_info = InvalidInput;
      m_isInitialized = false;
      m_sluL.Store = 0;
      m_sluU.Store = 0;
    }
template<typename _MatrixType, typename Derived>
void Eigen::SuperLUBase< _MatrixType, Derived >::initFactorization ( const MatrixType a) [inline, protected]

Definition at line 365 of file SuperLUSupport.h.

    {
      set_default_options(&this->m_sluOptions);
      
      const Index size = a.rows();
      m_matrix = a;

      m_sluA = internal::asSluMatrix(m_matrix);
      clearFactors();

      m_p.resize(size);
      m_q.resize(size);
      m_sluRscale.resize(size);
      m_sluCscale.resize(size);
      m_sluEtree.resize(size);

      // set empty B and X
      m_sluB.setStorageType(SLU_DN);
      m_sluB.setScalarType<Scalar>();
      m_sluB.Mtype          = SLU_GE;
      m_sluB.storage.values = 0;
      m_sluB.nrow           = 0;
      m_sluB.ncol           = 0;
      m_sluB.storage.lda    = internal::convert_index<int>(size);
      m_sluX                = m_sluB;
      
      m_extractedDataAreDirty = true;
    }
template<typename _MatrixType, typename Derived>
superlu_options_t& Eigen::SuperLUBase< _MatrixType, Derived >::options ( ) [inline]
Returns:
a reference to the Super LU option object to configure the Super LU algorithms.

Definition at line 325 of file SuperLUSupport.h.

{ return m_sluOptions; }
template<typename _MatrixType, typename Derived>
Index Eigen::SuperLUBase< _MatrixType, Derived >::rows ( void  ) const [inline]

Definition at line 321 of file SuperLUSupport.h.

{ return m_matrix.rows(); }

Member Data Documentation

template<typename _MatrixType, typename Derived>
int Eigen::SuperLUBase< _MatrixType, Derived >::m_analysisIsOk [protected]

Definition at line 437 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
bool Eigen::SuperLUBase< _MatrixType, Derived >::m_extractedDataAreDirty [mutable, protected]

Definition at line 438 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
int Eigen::SuperLUBase< _MatrixType, Derived >::m_factorizationIsOk [protected]

Definition at line 436 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
ComputationInfo Eigen::SuperLUBase< _MatrixType, Derived >::m_info [mutable, protected]

Definition at line 435 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
LUMatrixType Eigen::SuperLUBase< _MatrixType, Derived >::m_l [mutable, protected]

Definition at line 419 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
LUMatrixType Eigen::SuperLUBase< _MatrixType, Derived >::m_matrix [mutable, protected]

Definition at line 424 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
IntColVectorType Eigen::SuperLUBase< _MatrixType, Derived >::m_p [mutable, protected]

Definition at line 421 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
IntRowVectorType Eigen::SuperLUBase< _MatrixType, Derived >::m_q [mutable, protected]

Definition at line 422 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
SluMatrix Eigen::SuperLUBase< _MatrixType, Derived >::m_sluA [mutable, protected]

Definition at line 425 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
SluMatrix Eigen::SuperLUBase< _MatrixType, Derived >::m_sluB [mutable, protected]

Definition at line 427 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
Matrix<RealScalar,Dynamic,1> Eigen::SuperLUBase< _MatrixType, Derived >::m_sluBerr [mutable, protected]

Definition at line 432 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
Matrix<RealScalar,Dynamic,1> Eigen::SuperLUBase< _MatrixType, Derived >::m_sluCscale [mutable, protected]

Definition at line 431 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
char Eigen::SuperLUBase< _MatrixType, Derived >::m_sluEqued [mutable, protected]

Definition at line 433 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
std::vector<int> Eigen::SuperLUBase< _MatrixType, Derived >::m_sluEtree [mutable, protected]

Definition at line 430 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
Matrix<RealScalar,Dynamic,1> Eigen::SuperLUBase< _MatrixType, Derived >::m_sluFerr [mutable, protected]

Definition at line 432 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
SuperMatrix Eigen::SuperLUBase< _MatrixType, Derived >::m_sluL [mutable, protected]

Definition at line 426 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
superlu_options_t Eigen::SuperLUBase< _MatrixType, Derived >::m_sluOptions [mutable, protected]

Definition at line 429 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
Matrix<RealScalar,Dynamic,1> Eigen::SuperLUBase< _MatrixType, Derived >::m_sluRscale [mutable, protected]

Definition at line 431 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
SuperLUStat_t Eigen::SuperLUBase< _MatrixType, Derived >::m_sluStat [mutable, protected]

Definition at line 428 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
SuperMatrix Eigen::SuperLUBase< _MatrixType, Derived >::m_sluU [mutable, protected]

Definition at line 426 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
SluMatrix Eigen::SuperLUBase< _MatrixType, Derived >::m_sluX [mutable, protected]

Definition at line 427 of file SuperLUSupport.h.

template<typename _MatrixType, typename Derived>
LUMatrixType Eigen::SuperLUBase< _MatrixType, Derived >::m_u [mutable, protected]

Definition at line 420 of file SuperLUSupport.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines