MatCreateLREP — SLEPc 3.25.1 documentation

Skip to main content
`Ctrl`+`K`

# MatCreateLREP

Create a matrix that can be used to define a structured Linear Response eigenvalue problem.

## Synopsis

    #include "slepcsys.h"
    PetscErrorCode MatCreateLREP(Mat AK,Mat BM,PetscBool red,Mat *H)

Collective

## Input Parameters

- AK - matrix for the diagonal block (\(A\)) or the top block (\(K\))

- BM - matrix for the off-diagonal block (\(B\)) or the bottom block (\(M\))

- red - whether the reduced form should be built

## Output Parameter

- H - the resulting matrix

## Notes

The resulting matrix has the block form

\[\begin{split}H = \begin{bmatrix} A & B \\ -B & -A \end{bmatrix},\end{split}\]
where both \(A\) and \(B\) are assumed to be real symmetric. An alternative form, called reduced form (`red`=`PETSC_TRUE`) is
\[\begin{split}H = \begin{bmatrix} 0 & K \\ M & 0 \end{bmatrix},\end{split}\]
where both \(K\) and \(M\) are also assumed to be real symmetric. Note that this function does not check these properties, so if the matrices provided by the user do not satisfy them, then the solver will not behave as expected.

The reduced form can be obtained from the original formulation by setting \(K=A-B\) and \(M=A+B\). However, \(K\) and \(M\) need not have such relation, in which case the computed eigenvalues will be \(\pm\lambda_i\), where \(\lambda_i^2\) are the eigenvalues of the product eigenvalue problem \(KM\) (or \(MK\)).

The obtained matrix can be used as an input matrix to `EPS` eigensolvers via `EPSSetOperators()` for the case that the problem type is `EPS_LREP`. Note that the user cannot just build a matrix with the required structure, it must be done via this function.

In the current implementation, `H` is a `MATNEST` matrix, where `A` and `B` form the top block row, while the bottom block row is composed of shell matrices scaled by -1. Similarly, in the reduced formulation, the `MATNEST` has two zero blocks.

Internally, the eigensolver will work with the reduced form, and it will carry out the conversion transparently if the first form is provided by the user.

## See Also

Structured Eigenvalue Problems, `MatCreateNest()`, `EPSSetOperators()`, `EPSSetProblemType()`, `MatCreateBSE()`, `MatCreateHamiltonian()`

## Level

intermediate

## Location

src/sys/mat/matstruct.c

## Examples

src/eps/tutorials/ex58.c

Index of all Sys routines Table of Contents for all manual pages Index of all manual pages