qrupdate-ng 1.2.0
Loading...
Searching...
No Matches
zchdex.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 zchdex(n,R,ldr,j,rw)
26!>
27!> .. Scalar Arguments ..
28!> integer n, ldr, j
29!> ..
30!> .. Array Arguments ..
31!> double complex R(ldr,*)
32!> double precision rw(*)
33!> ..
34!> \endverbatim
35!>
36!> \par Purpose:
37! =============
38!> \verbatim
39!>
40!> ZCHDEX updates the Cholesky factorization of a hermitian
41!> positive definite matrix A after deleting a row/column.
42!> Given an upper triangular matrix R that is a Cholesky
43!> factor of A, i.e., A = R'*R, where R' denotes the conjugate
44!> transpose of R, ZCHDEX updates R -> R1 so that
45!> R1'*R1 = A(jj,jj), where jj = [1:j-1, j+1:n+1].
46!> \endverbatim
47!>
48!> \param[in] n
49!> \verbatim
50!> n is INTEGER
51!> The order of matrix R. n >= 0.
52!> \endverbatim
53!>
54!> \param[in,out] R
55!> \verbatim
56!> R is COMPLEX*16 array, dimension (ldr,n)
57!> On entry, the upper triangular matrix R, the Cholesky
58!> factor of A. On exit, the updated upper triangular
59!> matrix R1, the Cholesky factor of A(jj,jj).
60!> \endverbatim
61!>
62!> \param[in] ldr
63!> \verbatim
64!> ldr is INTEGER
65!> The leading dimension of the array R. ldr >= n.
66!> \endverbatim
67!>
68!> \param[in] j
69!> \verbatim
70!> j is INTEGER
71!> The position of the deleted row/column.
72!> \endverbatim
73!>
74!> \param[out] rw
75!> \verbatim
76!> rw is DOUBLE PRECISION array, dimension (n)
77!> A workspace vector.
78!> \endverbatim
79!>
80!> \ingroup choldecomp
81subroutine zchdex(n,R,ldr,j,rw)
82 use iso_fortran_env
84 integer, intent(in) :: n, ldr, j
85 complex(real64), intent(inout) :: R(ldr,*)
86 real(real64), intent(out) :: rw(*)
87 integer info,i
88 external zcopy,zqhqr
89 ! quick return if possible.
90 if (n == 1) return
91 ! check arguments
92 info = 0
93 if (n < 0) then
94 info = 1
95 else if (j < 1 .or. j > n) then
96 info = 4
97 end if
98 if (info /= 0) then
99 call qrupdate_xerror('ZCHDEX',info)
100 return
101 end if
102 ! delete the j-th column.
103 do i = j,n-1
104 call zcopy(n,r(1,i+1),1,r(1,i),1)
105 end do
106 ! retriangularize.
107 if (j < n) then
108 call zqhqr(n+1-j,n-j,r(j,j),ldr,rw,r(1,n))
109 end if
110end subroutine
subroutine zchdex(n, r, ldr, j, rw)
Updates a Cholesky factorization after deleting a row and column.
Definition zchdex.f90:82
subroutine qrupdate_xerror(srname, info)
Dispatches error reporting to the handler.
subroutine zqhqr(m, n, r, ldr, c, s)
Reduces an upper Hessenberg matrix to upper trapezoidal form.
Definition zqhqr.f90:91
Module for custom error handling.