qrupdate-ng 1.2.0
Loading...
Searching...
No Matches
schdex.f90
Go to the documentation of this file.
1! Copyright (C) 2008, 2009 VZLU Prague, a.s., Czech Republic, Jaroslav Hajek <highegg@gmail.com>
2! Copyright (C) 2026 Martin Köhler <koehlerm(AT)mpi-magdeburg.mpg.de>
3!
4! This file is part of qrupdate-ng.
5!
6! qrupdate is free software; you can redistribute it and/or modify
7! it under the terms of the GNU General Public License as published by
8! the Free Software Foundation; either version 3 of the License, or
9! (at your option) any later version.
10!
11! This program is distributed in the hope that it will be useful,
12! but WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14! GNU General Public License for more details.
15!
16! You should have received a copy of the GNU General Public License
17! along with this software; see the file COPYING. If not, see
18! <http://www.gnu.org/licenses/>.
19!
20!> \brief Updates a Cholesky factorization after deleting a row and column.
21!>
22!> \par Definition:
23! =============
24!> \verbatim
25!> subroutine schdex(n,R,ldr,j,w)
26!>
27!> .. Scalar Arguments ..
28!> integer n, ldr, j
29!> ..
30!> .. Array Arguments ..
31!> real R(ldr,*), w(*)
32!> ..
33!> \endverbatim
34!>
35!> \par Purpose:
36! =============
37!> \verbatim
38!>
39!> SCHDEX updates the Cholesky factorization of a symmetric
40!> positive definite matrix A after deleting a row/column.
41!> Given an upper triangular matrix R that is a Cholesky
42!> factor of A, i.e., A = R.'*R, where R.' denotes the
43!> transpose of R, SCHDEX updates R -> R1 so that
44!> R1.'*R1 = A(jj,jj), where jj = [1:j-1, j+1:n+1].
45!> \endverbatim
46!>
47!> \param[in] n
48!> \verbatim
49!> n is INTEGER
50!> The order of matrix R. n >= 0.
51!> \endverbatim
52!>
53!> \param[in,out] R
54!> \verbatim
55!> R is REAL array, dimension (ldr,n)
56!> On entry, the upper triangular matrix R, the Cholesky
57!> factor of A. On exit, the updated upper triangular
58!> matrix R1, the Cholesky factor of A(jj,jj).
59!> \endverbatim
60!>
61!> \param[in] ldr
62!> \verbatim
63!> ldr is INTEGER
64!> The leading dimension of the array R. ldr >= n.
65!> \endverbatim
66!>
67!> \param[in] j
68!> \verbatim
69!> j is INTEGER
70!> The position of the deleted row/column.
71!> \endverbatim
72!>
73!> \param[out] w
74!> \verbatim
75!> w is REAL array, dimension (n)
76!> A workspace vector.
77!> \endverbatim
78!>
79!> \ingroup choldecomp
80subroutine schdex(n,R,ldr,j,w)
81 use iso_fortran_env
83 integer, intent(in) :: n, ldr, j
84 real(real32), intent(inout) :: R(ldr,*)
85 real(real32), intent(out) :: w(*)
86 integer info,i
87 external scopy,sqhqr
88 ! quick return if possible.
89 if (n == 1) return
90 ! check arguments
91 info = 0
92 if (n < 0) then
93 info = 1
94 else if (j < 1 .or. j > n) then
95 info = 4
96 end if
97 if (info /= 0) then
98 call qrupdate_xerror('SCHDEX',info)
99 return
100 end if
101 ! delete the j-th column.
102 do i = j,n-1
103 call scopy(n,r(1,i+1),1,r(1,i),1)
104 end do
105 ! retriangularize.
106 if (j < n) then
107 call sqhqr(n+1-j,n-j,r(j,j),ldr,w,r(1,n))
108 end if
109end subroutine
subroutine schdex(n, r, ldr, j, w)
Updates a Cholesky factorization after deleting a row and column.
Definition schdex.f90:81
subroutine qrupdate_xerror(srname, info)
Dispatches error reporting to the handler.
subroutine sqhqr(m, n, r, ldr, c, s)
Reduces an upper Hessenberg matrix to upper trapezoidal form.
Definition sqhqr.f90:90
Module for custom error handling.