Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
|
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:
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... | |
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:
a | the matrix to be factorized | |
[in] | n | the problem size (A is nXn) |
[out] | ipiv | an ineteger array of length n on wich pivoting information will be returned |
[out] | cts | a real array of size 7n where factorization information will be returned |
Definition at line 161 of file sll_m_tridiagonal.F90.
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.
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.
cts | a real array of size 7n where factorization information will be returned | |
[in] | ipiv | an ineteger array of length n on wich pivoting information will be returned |
b | the second member of the equation | |
n | the problem size | |
x | the solution vector |
Definition at line 527 of file sll_m_tridiagonal.F90.
|
private |
Complex version of sll_s_solve_cyclic_tridiag_double.
cts | a real array of size 7n where factorization information will be returned | |
[in] | ipiv | an ineteger array of length n on wich pivoting information will be returned |
b | the second member of the equation | |
n | the problem size | |
x | the solution vector |
Definition at line 602 of file sll_m_tridiagonal.F90.