!> !> @file fcblok.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 fcblok ( bloks, integs, nbloks, ipivot, scrtch, iflag ) !************************************************************************* ! !! FCBLOK supervises the PLU factorization with pivoting of ! scaled rows of the almost block diagonal matrix. ! ! The almost block diagonal matrix is stored in the arrays ! BLOKS and INTEGS. ! ! The FACTRB routine carries out steps 1,...,last of gauss ! elimination (with pivoting) for an individual block. ! ! The SHIFTB routine shifts the remaining rows to the top of ! the next block ! ! Reference: ! ! Carl DeBoor, ! A Practical Guide to Splines, ! Springer Verlag. ! ! Parameters: ! ! bloks an array that initially contains the almost block diagonal ! matrix a to be factored, and on return contains the com- ! puted factorization of a . ! ! integs an integer array describing the block structure of a . ! ! nbloks the number of blocks in a . ! ! ipivot an integer array of dimension sum (integs(1,n) ; n=1, ! ...,nbloks) which, on return, contains the pivoting stra- ! tegy used. ! ! scrtch work area required, of length max (integs(1,n) ; n=1, ! ...,nbloks). ! ! iflag output parameter; ! =0 in case matrix was found to be singular. ! otherwise, ! =(-1)**(number of row interchanges during factorization) ! implicit none integer nbloks real ( kind = 8 ) bloks(*) integer i integer iflag integer index integer indexb integer indexn integer integs(3,nbloks) integer ipivot(*) integer last integer ncol integer nrow real ( kind = 8 ) scrtch(*) iflag = 1 indexb = 1 indexn = 1 i = 1 ! ! Loop over the blocks. i is loop index ! do index = indexn nrow = integs(1,i) ncol = integs(2,i) last = integs(3,i) ! ! Carry out elimination on the I-th block until next block ! enters, for columns 1 through LAST of I-th block. ! call factrb ( bloks(index), ipivot(indexb), scrtch, nrow, ncol, & last, iflag ) ! ! Check for having reached a singular block or the last block. ! if ( iflag == 0 .or. i == nbloks ) then exit end if i = i + 1 indexn = nrow * ncol + index ! ! Put the rest of the I-th block onto the next block. ! call shiftb ( bloks(index), ipivot(indexb), nrow, ncol, last, & bloks(indexn), integs(1,i), integs(2,i) ) indexb = indexb + nrow end do return end