!> !> @file sbblok.f90 !> !> @brief !> !> @copyright !> Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) !> SPC (Swiss Plasma Center) !> !> SPClibs is free software: you can redistribute it and/or modify it under !> the terms of the GNU Lesser General Public License as published by the Free !> Software Foundation, either version 3 of the License, or (at your option) !> any later version. !> !> SPClibs is distributed in the hope that it will be useful, but WITHOUT ANY !> WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS !> FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. !> !> You should have received a copy of the GNU Lesser General Public License !> along with this program. If not, see . !> !> @author !> (in alphabetical order) !> @author Trach-Minh Tran !> subroutine sbblok ( bloks, integs, nbloks, ipivot, b, x ) !************************************************************************* ! !! SBBLOK solves a linear system that was factored by FCBLOK. ! ! Discussion: ! ! The routine supervises the solution, by forward and backward ! substitution, of the linear system ! ! A * x = b ! ! for X, with the PLU factorization of A already generated in FCBLOK. ! Individual blocks of equations are solved via SUBFOR and SUBBAK. ! ! Reference: ! ! Carl DeBoor, ! A Practical Guide to Splines, ! Springer Verlag. ! ! Parameters: ! ! bloks, integs, nbloks, ipivot are as on return from fcblok. ! ! b the right side, stored corresponding to the storage of ! the equations. see comments in SLVBLK for details. ! ! Output, real ( kind = 8 ) X(*), the solution vector. ! implicit none integer nbloks real ( kind = 8 ) b(*) real ( kind = 8 ) bloks(*) integer i integer index integer indexb integer indexx integer integs(3,nbloks) integer ipivot(*) integer j integer last integer nbp1 integer ncol integer nrow real ( kind = 8 ) x(*) ! ! Forward substitution pass: ! index = 1 indexb = 1 indexx = 1 do i = 1, nbloks nrow = integs(1,i) last = integs(3,i) call subfor(bloks(index),ipivot(indexb),nrow,last,b(indexb),x(indexx)) index = nrow*integs(2,i)+index indexb = indexb+nrow indexx = indexx+last end do ! ! Back substitution pass. ! nbp1 = nbloks + 1 do j = 1, nbloks i = nbp1 - j nrow = integs(1,i) ncol = integs(2,i) last = integs(3,i) index = index - nrow * ncol indexb = indexb - nrow indexx = indexx - last call subbak ( bloks(index), ipivot(indexb), nrow, ncol, last, x(indexx) ) end do return end