Eigen::SluMatrix Struct Reference

#include <SuperLUSupport.h>

+ Inheritance diagram for Eigen::SluMatrix:

Public Member Functions

 SluMatrix ()
 
 SluMatrix (const SluMatrix &other)
 
SluMatrixoperator= (const SluMatrix &other)
 
void setStorageType (Stype_t t)
 
template<typename Scalar >
void setScalarType ()
 

Static Public Member Functions

template<typename MatrixType >
static SluMatrix Map (MatrixBase< MatrixType > &_mat)
 
template<typename MatrixType >
static SluMatrix Map (SparseMatrixBase< MatrixType > &a_mat)
 

Public Attributes

struct {
   union {
      int   nnz
 
      int   lda
 
   } 
 
   void *   values
 
   int *   innerInd
 
   int *   outerInd
 
storage
 
- Public Attributes inherited from SuperMatrix
Stype_t Stype
 
Dtype_t Dtype
 
Mtype_t Mtype
 
int_t nrow
 
int_t ncol
 
void * Store
 

Detailed Description

A wrapper class for SuperLU matrices. It supports only compressed sparse matrices and dense matrices. Supernodal and other fancy format are not supported by this wrapper.

This wrapper class mainly aims to avoids the need of dynamic allocation of the storage structure.

Constructor & Destructor Documentation

◆ SluMatrix() [1/2]

Eigen::SluMatrix::SluMatrix ( )
inline
102 { Store = &storage; }
struct Eigen::SluMatrix::@890 storage
void * Store
Definition: oomph_superlu_4.3/supermatrix.h:51

References storage, and SuperMatrix::Store.

◆ SluMatrix() [2/2]

Eigen::SluMatrix::SluMatrix ( const SluMatrix other)
inline
104  : SuperMatrix(other) {
105  Store = &storage;
106  storage = other.storage;
107  }
Definition: oomph_superlu_4.3/supermatrix.h:43

References storage, and SuperMatrix::Store.

Member Function Documentation

◆ Map() [1/2]

template<typename MatrixType >
static SluMatrix Eigen::SluMatrix::Map ( MatrixBase< MatrixType > &  _mat)
inlinestatic
152  {
153  MatrixType &mat(_mat.derived());
154  eigen_assert(((MatrixType::Flags & RowMajorBit) != RowMajorBit) &&
155  "row-major dense matrices are not supported by SuperLU");
156  SluMatrix res;
157  res.setStorageType(SLU_DN);
158  res.setScalarType<typename MatrixType::Scalar>();
159  res.Mtype = SLU_GE;
160 
161  res.nrow = internal::convert_index<int>(mat.rows());
162  res.ncol = internal::convert_index<int>(mat.cols());
163 
164  res.storage.lda = internal::convert_index<int>(MatrixType::IsVectorAtCompileTime ? mat.size() : mat.outerStride());
165  res.storage.values = (void *)(mat.data());
166  return res;
167  }
Eigen::SparseMatrix< double > mat
Definition: EigenUnitTest.cpp:10
#define eigen_assert(x)
Definition: Macros.h:910
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Index size() const
Definition: SparseMatrixBase.h:187
Index cols() const
Definition: SparseMatrix.h:161
Index rows() const
Definition: SparseMatrix.h:159
constexpr Storage & data()
Definition: SparseMatrix.h:205
const unsigned int RowMajorBit
Definition: Constants.h:70
@ SLU_GE
Definition: oomph_superlu_4.3/supermatrix.h:32
@ SLU_DN
Definition: oomph_superlu_4.3/supermatrix.h:20
SluMatrix()
Definition: SuperLUSupport.h:102

References Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::cols(), Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::data(), eigen_assert, res, Eigen::RowMajorBit, Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::rows(), Eigen::SparseMatrixBase< Derived >::size(), SLU_DN, and SLU_GE.

Referenced by Eigen::SuperLU< MatrixType_ >::_solve_impl(), and Eigen::internal::asSluMatrix().

◆ Map() [2/2]

template<typename MatrixType >
static SluMatrix Eigen::SluMatrix::Map ( SparseMatrixBase< MatrixType > &  a_mat)
inlinestatic
170  {
171  MatrixType &mat(a_mat.derived());
172  SluMatrix res;
173  if ((MatrixType::Flags & RowMajorBit) == RowMajorBit) {
174  res.setStorageType(SLU_NR);
175  res.nrow = internal::convert_index<int>(mat.cols());
176  res.ncol = internal::convert_index<int>(mat.rows());
177  } else {
178  res.setStorageType(SLU_NC);
179  res.nrow = internal::convert_index<int>(mat.rows());
180  res.ncol = internal::convert_index<int>(mat.cols());
181  }
182 
183  res.Mtype = SLU_GE;
184 
185  res.storage.nnz = internal::convert_index<int>(mat.nonZeros());
186  res.storage.values = mat.valuePtr();
187  res.storage.innerInd = mat.innerIndexPtr();
188  res.storage.outerInd = mat.outerIndexPtr();
189 
190  res.setScalarType<typename MatrixType::Scalar>();
191 
192  // FIXME the following is not very accurate
193  if (int(MatrixType::Flags) & int(Upper)) res.Mtype = SLU_TRU;
194  if (int(MatrixType::Flags) & int(Lower)) res.Mtype = SLU_TRL;
195 
196  eigen_assert(((int(MatrixType::Flags) & int(SelfAdjoint)) == 0) &&
197  "SelfAdjoint matrix shape not supported by SuperLU");
198 
199  return res;
200  }
Index nonZeros() const
Definition: SparseCompressedBase.h:64
const Scalar * valuePtr() const
Definition: SparseMatrix.h:171
const StorageIndex * outerIndexPtr() const
Definition: SparseMatrix.h:189
const StorageIndex * innerIndexPtr() const
Definition: SparseMatrix.h:180
@ SelfAdjoint
Definition: Constants.h:227
@ Lower
Definition: Constants.h:211
@ Upper
Definition: Constants.h:213
return int(ret)+1
if(UPLO(*uplo)==INVALID) info
Definition: level3_impl.h:428
@ SLU_TRL
Definition: oomph_superlu_4.3/supermatrix.h:35
@ SLU_TRU
Definition: oomph_superlu_4.3/supermatrix.h:36
@ SLU_NC
Definition: oomph_superlu_4.3/supermatrix.h:12
@ SLU_NR
Definition: oomph_superlu_4.3/supermatrix.h:16

References Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::cols(), Eigen::SparseMatrixBase< Derived >::derived(), eigen_assert, if(), Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::innerIndexPtr(), int(), Eigen::Lower, Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::nonZeros(), Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::outerIndexPtr(), res, Eigen::RowMajorBit, Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::rows(), Eigen::SelfAdjoint, SLU_GE, SLU_NC, SLU_NR, SLU_TRL, SLU_TRU, Eigen::Upper, and Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::valuePtr().

◆ operator=()

SluMatrix& Eigen::SluMatrix::operator= ( const SluMatrix other)
inline
109  {
110  SuperMatrix::operator=(static_cast<const SuperMatrix &>(other));
111  Store = &storage;
112  storage = other.storage;
113  return *this;
114  }

References storage, and SuperMatrix::Store.

◆ setScalarType()

template<typename Scalar >
void Eigen::SluMatrix::setScalarType ( )
inline
137  {
139  Dtype = SLU_S;
141  Dtype = SLU_D;
142  else if (internal::is_same<Scalar, std::complex<float> >::value)
143  Dtype = SLU_C;
144  else if (internal::is_same<Scalar, std::complex<double> >::value)
145  Dtype = SLU_Z;
146  else {
147  eigen_assert(false && "Scalar type not supported by SuperLU");
148  }
149  }
squared absolute value
Definition: GlobalFunctions.h:87
@ SLU_S
Definition: oomph_superlu_4.3/supermatrix.h:25
@ SLU_Z
Definition: oomph_superlu_4.3/supermatrix.h:28
@ SLU_C
Definition: oomph_superlu_4.3/supermatrix.h:27
@ SLU_D
Definition: oomph_superlu_4.3/supermatrix.h:26
@ value
Definition: Meta.h:206
Dtype_t Dtype
Definition: oomph_superlu_4.3/supermatrix.h:46

References SuperMatrix::Dtype, eigen_assert, SLU_C, SLU_D, SLU_S, SLU_Z, and Eigen::value.

Referenced by Eigen::SuperLUBase< MatrixType_, Derived >::initFactorization().

◆ setStorageType()

void Eigen::SluMatrix::setStorageType ( Stype_t  t)
inline
126  {
127  Stype = t;
128  if (t == SLU_NC || t == SLU_NR || t == SLU_DN)
129  Store = &storage;
130  else {
131  eigen_assert(false && "storage type not supported");
132  Store = 0;
133  }
134  }
t
Definition: plotPSD.py:36
Stype_t Stype
Definition: oomph_superlu_4.3/supermatrix.h:44

References eigen_assert, SLU_DN, SLU_NC, SLU_NR, storage, SuperMatrix::Store, SuperMatrix::Stype, and plotPSD::t.

Referenced by Eigen::SuperLUBase< MatrixType_, Derived >::initFactorization().

Member Data Documentation

◆ innerInd

int* Eigen::SluMatrix::innerInd

◆ lda

◆ nnz

int Eigen::SluMatrix::nnz

◆ outerInd

int* Eigen::SluMatrix::outerInd

◆ 

◆ values


The documentation for this struct was generated from the following file: