v0.14.0
Static Public Member Functions | List of all members
MoFEM::SCHUR_DGESV Struct Reference

Static Public Member Functions

static auto invertMat (MatrixDouble &m, MatrixDouble &inv, double eps)
 

Detailed Description

Definition at line 540 of file Schur.cpp.

Member Function Documentation

◆ invertMat()

static auto MoFEM::SCHUR_DGESV::invertMat ( MatrixDouble m,
MatrixDouble inv,
double  eps 
)
inlinestatic

Definition at line 541 of file Schur.cpp.

541  {
543  VectorInt ipiv;
544  const auto nb = m.size1();
545 #ifndef NDEBUG
546  if (nb != m.size2()) {
547  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
548  "It should be square matrix");
549  }
550 #endif
551 
552  if (eps) {
553  for (int cc = 0; cc != nb; ++cc) {
554  m(cc, cc) += eps;
555  }
556  }
557 
558  inv.resize(nb, nb, false);
559  inv.clear();
560  auto ptr = &*inv.data().begin();
561  for (int c = 0; c != nb; ++c, ptr += nb + 1)
562  *ptr = -1;
563  ipiv.resize(nb, false);
564  const auto info = lapack_dgesv(nb, nb, &*m.data().begin(), nb,
565  &*ipiv.begin(), &*inv.data().begin(), nb);
566  if (info != 0)
567  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
568  "Can not invert matrix info = %d", info);
570  };

The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
lapack_dgesv
static __CLPK_integer lapack_dgesv(__CLPK_integer n, __CLPK_integer nrhs, __CLPK_doublereal *a, __CLPK_integer lda, __CLPK_integer *ipiv, __CLPK_doublereal *b, __CLPK_integer ldb)
Definition: lapack_wrap.h:176
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
MoFEM::Types::VectorInt
UBlasVector< int > VectorInt
Definition: Types.hpp:67
eps
static const double eps
Definition: check_base_functions_derivatives_on_tet.cpp:11
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440