v0.14.0
Loading...
Searching...
No Matches
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 };
static const double eps
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
FTensor::Index< 'm', SPACE_DIM > m
const double c
speed of light (cm/ns)
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
UBlasVector< int > VectorInt
Definition: Types.hpp:67

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