shiftb Subroutine

subroutine shiftb(ai, ipivot, nrowi, ncoli, last, ai1, nrowi1, ncoli1)

************80

! SHIFTB shifts the rows in the current block.

Discussion:

This routine shifts rows in the current block, AI, which are not used
as pivot rows, if any, that is, rows IPIVOT(LAST+1) through IPIVOT(NROWI),
onto the first MMAX = NROW - LAST rows of the next block, AI1,
with column LAST + J of AI going to column J,
for J = 1,..., JMAX = NCOLI - LAST.

The remaining columns of these rows of AI1 are zeroed out.

Diagram:

   Original situation after         Results in a new block I+1
   LAST = 2 columns have been       created and ready to be
   done in FACTRB, assuming no      factored by next FACTRB call.
   interchanges of rows.

               1
          X  X 1X  X  X           X  X  X  X  X
               1
          0  X 1X  X  X           0  X  X  X  X

BLOCK I 1 --------------- NROWI=4 0 0 1X X X 0 0 1X X X 0 01 NCOLI=5 1 1 1 LAST=2 0 0 1X X X 0 0 1X X X 0 01 ------------------- 1 1 NEW 1X X X X X 1X X X X X1 BLOCK 1 1 1 I+1 BLOCK I+1 1X X X X X 1X X X X X1 NROWI1= 5 1 1 1 NCOLI1= 5 1X X X X X 1X X X X X1 ------------------- 1-------------1 1

Modified:

14 February 2007

Author:

Carl DeBoor

Reference:

Carl DeBoor,
A Practical Guide to Splines,
Springer, 2001,
ISBN: 0387953663,
LC: QA1.A647.v27.

Parameters:

Input, real ( kind = 8 ) AI(NROWI,NCOLI), the current block.

Input, integer ( kind = 4 ) IPIVOT(NROWI), the pivot vector.

Input, integer ( kind = 4 ) NROWI, NCOLI, the number of rows and columns
in block AI.

Input, integer ( kind = 4 ) LAST, indicates the last row on which pivoting
has been carried out.

Input/output, real ( kind = 8 ) AI1(NROWI1,NCOLI1), the next block.

Input, integer ( kind = 4 ) NROWI1, NCOLI1, the number of rows and columns
in block AI1.

Arguments

Type IntentOptional Attributes Name
real(kind=8) :: ai(nrowi,ncoli)
integer(kind=4) :: ipivot(nrowi)
integer(kind=4) :: nrowi
integer(kind=4) :: ncoli
integer(kind=4) :: last
real(kind=8) :: ai1(nrowi1,ncoli1)
integer(kind=4) :: nrowi1
integer(kind=4) :: ncoli1

Source Code

subroutine shiftb ( ai, ipivot, nrowi, ncoli, last, ai1, nrowi1, ncoli1 )

  !*****************************************************************************80
  !
  !! SHIFTB shifts the rows in the current block.
  !
  !  Discussion:
  !
  !    This routine shifts rows in the current block, AI, which are not used 
  !    as pivot rows, if any, that is, rows IPIVOT(LAST+1) through IPIVOT(NROWI), 
  !    onto the first MMAX = NROW - LAST rows of the next block, AI1, 
  !    with column LAST + J of AI going to column J, 
  !    for J = 1,..., JMAX = NCOLI - LAST.
  !
  !    The remaining columns of these rows of AI1 are zeroed out.
  !
  !  Diagram:
  !
  !       Original situation after         Results in a new block I+1
  !       LAST = 2 columns have been       created and ready to be
  !       done in FACTRB, assuming no      factored by next FACTRB call.
  !       interchanges of rows.
  !
  !                   1
  !              X  X 1X  X  X           X  X  X  X  X
  !                   1
  !              0  X 1X  X  X           0  X  X  X  X
  !  BLOCK I          1                       ---------------
  !  NROWI=4     0  0 1X  X  X           0  0 1X  X  X  0  01
  !  NCOLI=5          1                       1             1
  !  LAST=2      0  0 1X  X  X           0  0 1X  X  X  0  01
  !              -------------------          1             1   NEW
  !                   1X  X  X  X  X          1X  X  X  X  X1  BLOCK
  !                   1                       1             1   I+1
  !  BLOCK I+1        1X  X  X  X  X          1X  X  X  X  X1
  !  NROWI1= 5        1                       1             1
  !  NCOLI1= 5        1X  X  X  X  X          1X  X  X  X  X1
  !              -------------------          1-------------1
  !                   1
  !
  !  Modified:
  !
  !    14 February 2007
  !
  !  Author:
  !
  !    Carl DeBoor
  !
  !  Reference:
  !
  !    Carl DeBoor,
  !    A Practical Guide to Splines,
  !    Springer, 2001,
  !    ISBN: 0387953663,
  !    LC: QA1.A647.v27.
  !
  !  Parameters:
  !
  !    Input, real ( kind = 8 ) AI(NROWI,NCOLI), the current block.
  !
  !    Input, integer ( kind = 4 ) IPIVOT(NROWI), the pivot vector.
  !
  !    Input, integer ( kind = 4 ) NROWI, NCOLI, the number of rows and columns
  !    in block AI.
  !
  !    Input, integer ( kind = 4 ) LAST, indicates the last row on which pivoting
  !    has been carried out.
  !
  !    Input/output, real ( kind = 8 ) AI1(NROWI1,NCOLI1), the next block.
  !
  !    Input, integer ( kind = 4 ) NROWI1, NCOLI1, the number of rows and columns
  !    in block AI1.
  !
  implicit none

  integer ( kind = 4 ) ncoli
  integer ( kind = 4 ) ncoli1
  integer ( kind = 4 ) nrowi1
  integer ( kind = 4 ) nrowi

  real ( kind = 8 ) ai(nrowi,ncoli)
  real ( kind = 8 ) ai1(nrowi1,ncoli1)
  integer ( kind = 4 ) ip
  integer ( kind = 4 ) ipivot(nrowi)
  integer ( kind = 4 ) j
  integer ( kind = 4 ) last
  integer ( kind = 4 ) m

  if ( nrowi - last < 1 ) then
     return
  end if

  if ( ncoli - last < 1 ) then
     return
  end if
  !
  !  Put the remainder of block I into AI1.
  !
  do m = 1, nrowi - last
     ip = ipivot(last+m)
     do j = 1, ncoli - last
        ai1(m,j) = ai(ip,last+j)
     end do
  end do
  !
  !  Zero out the upper right corner of AI1.
  !
  do j = ncoli + 1 - last, ncoli1
     do m = 1, nrowi - last
        ai1(m,j) = 0.0D+00
     end do
  end do

  return
end subroutine shiftb