qrupdate-ng
1.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
cch1up.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 a rank-1 modification.
21
!>
22
!> \par Definition:
23
! =============
24
!> \verbatim
25
!> subroutine cch1up(n,R,ldr,u,w)
26
!>
27
!> .. Scalar Arguments ..
28
!> integer n, ldr
29
!> ..
30
!> .. Array Arguments ..
31
!> complex R(ldr,*), u(*)
32
!> real w(*)
33
!> ..
34
!> \endverbatim
35
!>
36
!> \par Purpose:
37
! =============
38
!> \verbatim
39
!>
40
!> CCH1UP updates the Cholesky factorization of a hermitian
41
!> positive definite matrix A after a rank-1 modification. Given an
42
!> upper triangular matrix R that is a Cholesky factor of A, i.e.,
43
!> A = R'*R, where R' denotes the conjugate transpose of R, this
44
!> CCH1UP updates R -> R1 so that R1'*R1 = A + u*u', where u is
45
!> a given vector.
46
!>
47
!> The update is performed by applying a sequence of Givens rotations
48
!> to restore the upper triangular structure of R. On exit, u
49
!> contains the rotation sines and w contains the rotation cosines
50
!> used in the transformation.
51
!> \endverbatim
52
!>
53
!> \param[in] n
54
!> \verbatim
55
!> n is INTEGER
56
!> The order of matrix R. n >= 0.
57
!> \endverbatim
58
!>
59
!> \param[in,out] R
60
!> \verbatim
61
!> R is COMPLEX array, dimension (ldr,n)
62
!> On entry, the upper triangular matrix R, the Cholesky
63
!> factor of A. On exit, the updated upper triangular
64
!> matrix R1, the Cholesky factor of A + u*u'.
65
!> \endverbatim
66
!>
67
!> \param[in] ldr
68
!> \verbatim
69
!> ldr is INTEGER
70
!> The leading dimension of the array R. ldr >= n.
71
!> \endverbatim
72
!>
73
!> \param[in,out] u
74
!> \verbatim
75
!> u is COMPLEX array, dimension (n)
76
!> On entry, the vector determining the rank-1 update.
77
!> On exit, u contains the rotation sines used to
78
!> transform R to R1.
79
!> \endverbatim
80
!>
81
!> \param[out] w
82
!> \verbatim
83
!> w is REAL array, dimension (n)
84
!> On exit, w contains the cosine parts of the Givens
85
!> rotations used to transform R to R1.
86
!> \endverbatim
87
!>
88
!> \ingroup choldecomp
89
subroutine
cch1up
(n,R,ldr,u,w)
90
use
iso_fortran_env
91
integer
,
intent(in)
:: n, ldr
92
complex(real32)
,
intent(inout)
:: R(ldr,*)
93
complex(real32)
,
intent(inout)
:: u(*)
94
real
(real32),
intent(out)
:: w(*)
95
external
clartg
96
complex(real32)
rr,ui,t
97
integer
i,j
98
99
do
i = 1,n
100
! apply stored rotations, column-wise
101
ui = conjg(u(i))
102
do
j = 1,i-1
103
t = w(j)*r(j,i) + u(j)*ui
104
ui = w(j)*ui - conjg(u(j))*r(j,i)
105
r(j,i) = t
106
end do
107
! generate next rotation
108
call
clartg(r(i,i),ui,w(i),u(i),rr)
109
r(i,i) = rr
110
end do
111
end subroutine
cch1up
subroutine cch1up(n, r, ldr, u, w)
Updates a Cholesky factorization after a rank-1 modification.
Definition
cch1up.f90:90
src
cch1up.f90
Generated by
1.17.0