File lapack_routines.hxx#

Serial code to invert a complex tridiagonal system

Solves a banded matrix given the matrix in compact form:

a[0...(n-1)][0...(m1+m2)]
and the rhs vector:
b[0...(n-1)]
a is overwritten, and b is replaced by the solution

Functions

int tridag(const dcomplex *a, const dcomplex *b, const dcomplex *c, const dcomplex *r, dcomplex *u, int n)#

Tridiagonal inversion

Parameters:
  • a – Left of diagonal (so a[0] not used)

  • b – diagonal terms

  • c – Right of diagonal (so c[n-1] not used)

  • r – RHS vector

  • u – Result vector

  • n – Length of vectors

    b[0]   c[0]
    a[1]   b[1]   c[1]
            .       .    .
    
    Uses LAPACK routine ZGTSV

bool tridag(const BoutReal *a, const BoutReal *b, const BoutReal *c, const BoutReal *r, BoutReal *x, int n)#
void cyclic_tridag(BoutReal *a, BoutReal *b, BoutReal *c, BoutReal *r, BoutReal *x, int n)#

Cyclic tridiagonal

Uses Sherman-Morrison formula

void cyclic_tridag(dcomplex *a, dcomplex *b, dcomplex *c, dcomplex *r, dcomplex *x, int n)#
void cband_solve(Matrix<dcomplex> &a, int n, int m1, int m2, Array<dcomplex> &b)#

Complex band matrix solver using ZGBSV.