Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
Derived types and interfaces | Functions/Subroutines
sll_m_tridiagonal Module Reference

Description

Tridiagonal system solver.

To solve systems of the form Ax=b, where A is a tridiagonal matrix, Selalib offers a native, robust tridiagonal system solver. The present implementation contains only a serial version. The algorith is based on an LU factorisation of a given matrix, with row pivoting. The tridiagonal matrix must be given as a single array, with a memory layout shown next.

\[ A = \begin{bmatrix} a(2) & a(3) & & & & & a(1) \\ a(4) & a(5) & a(6) & & & & \\ & a(7) & a(8) & a(9) & & & \\ & & \ddots & \ddots & \ddots & & \\ & & & \ddots & \ddots & \ddots & \\ & & & & a(3n-5) & a(3n-4)&a(3n-3) \\ a(3n)& & & & & a(3n-2) & a(3n-1) \end{bmatrix} \]

Usage:

To solve a tridiagonal system, first:

  1. Assemble the matrix 'a' as a single array with the layout just described above
  2. Use 'sll_s_setup_cyclic_tridiag( a, n, cts, ipiv )' to factorize the system: In 'setup_cyclic_tridag', a is the array to be factorized, stored with the layout shown above. 'n' is essentially the problem size. cts and ipiv are respectively real and integer arrays of size 7*n and n that are needed to return factorization information. ipiv is the usual 'pivot' array.
  3. To solve the system, make a call to 'sll_o_solve_cyclic_tridiag(cts, ipiv, b, n, x)' Here, cts and ipiv are the ones returned by sll_s_setup_cyclic_tridiag. The function returns the solution to Ax = b, storing the results in 'x'. In case that an 'in-place' computation is desired, it is acceptable to make the call like: sll_o_solve_cyclic_tridiag(cts, ipiv, b, n, b)

Derived types and interfaces

interface  sll_o_solve_cyclic_tridiag
 Solve tridiagonal system (double or complex) More...
 

Functions/Subroutines

subroutine, public sll_s_setup_cyclic_tridiag (a, n, cts, ipiv)
 Give the factorization of the matrix in argument. More...
 
subroutine, public sll_s_solve_cyclic_tridiag_double (cts, ipiv, b, n, x)
 Solves tridiagonal system. More...
 
subroutine solve_cyclic_tridiag_complex (cts, ipiv, b, n, x)
 Complex version of sll_s_solve_cyclic_tridiag_double. More...
 

Function/Subroutine Documentation

◆ sll_s_setup_cyclic_tridiag()

subroutine, public sll_m_tridiagonal::sll_s_setup_cyclic_tridiag ( dimension(:)  a,
intent(in)  n,
target  cts,
dimension(1:n)  ipiv 
)

Give the factorization of the matrix in argument.

sll_s_setup_cyclic_tridiag has been adapted from the C version written by Kevin Bowers for the Desmond molecular dynamics code. For the Fortran implementation, we have adjusted the algorithm such that it is compatible with the 1-based array indexing:

Parameters
athe matrix to be factorized
[in]nthe problem size (A is nXn)
[out]ipivan ineteger array of length n on wich pivoting information will be returned
[out]ctsa real array of size 7n where factorization information will be returned

Definition at line 161 of file sll_m_tridiagonal.F90.

Here is the caller graph for this function:

◆ sll_s_solve_cyclic_tridiag_double()

subroutine, public sll_m_tridiagonal::sll_s_solve_cyclic_tridiag_double ( target  cts,
intent(in)  ipiv,
dimension(n), target  b,
intent(in)  n,
dimension(n), target  x 
)

Solves tridiagonal system.

Author
Routine Author Name and Affiliation.

Computes the solution of:

     <center> <b> A x = b </b> </center>

     For a cyclic tridiagonal matrix A. The matrix cts is filled with
     the output of the function sll_s_setup_cyclic_tridiag.  Note that the
     call:

     sll_o_solve_cyclic_tridiag( cts, ipiv, b, n, b )

     is valid if you want run in-place and overwrite the right hand side
     with the solution.
Parameters
ctsa real array of size 7n where factorization information will be returned
[in]ipivan ineteger array of length n on wich pivoting information will be returned
bthe second member of the equation
nthe problem size
xthe solution vector

Definition at line 527 of file sll_m_tridiagonal.F90.

Here is the caller graph for this function:

◆ solve_cyclic_tridiag_complex()

subroutine sll_m_tridiagonal::solve_cyclic_tridiag_complex ( target  cts,
intent(in)  ipiv,
dimension(n), target  b,
intent(in)  n,
dimension(n), target  x 
)
private

Complex version of sll_s_solve_cyclic_tridiag_double.

Parameters
ctsa real array of size 7n where factorization information will be returned
[in]ipivan ineteger array of length n on wich pivoting information will be returned
bthe second member of the equation
nthe problem size
xthe solution vector

Definition at line 602 of file sll_m_tridiagonal.F90.

    Report Typos and Errors