MatCreateHamiltonian — SLEPc 3.25.0 documentation

Skip to main content
`Ctrl`+`K`

# MatCreateHamiltonian

Create a matrix that can be used to define a structured eigenvalue problem of Hamiltonian type.

## Synopsis

    #include "slepcsys.h"
    PetscErrorCode MatCreateHamiltonian(Mat A,Mat B,Mat C,Mat *H)

Collective

## Input Parameters

- A - matrix for the (0,0) block

- B - matrix for the (0,1) block, must be real symmetric or complex Hermitian

- C - matrix for the (1,0) block, must be real symmetric or complex Hermitian

## Output Parameter

- H - the resulting matrix

## Notes

The resulting matrix has the block form

\[\begin{split}H = \begin{bmatrix} A & B \\ C & -A^* \end{bmatrix},\end{split}\]
where \(B\) and \(C\) are assumed to be symmetric in the real case or Hermitian in the complex case. Note that this function does not check this property, so if the matrices provided by the user do not satisfy it, then the solver will not behave as expected.

The obtained matrix can be used as an input matrix to `EPS` eigensolvers via `EPSSetOperators()` for the case that the problem type is `EPS_HAMILT`. 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 the (1,1) block is a matrix of type `MATHERMITIANTRANSPOSEVIRTUAL` obtained from `A` and scaled by -1.

## See Also

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

## Level

intermediate

## Location

src/sys/mat/matstruct.c

## Examples

src/eps/tutorials/ex56.c
src/eps/tutorials/ex57.c

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