qrupdate-ng
1.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
zqrder.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 QR factorization after deleting a row.
21
!>
22
!> \par Definition:
23
! =============
24
!> \verbatim
25
!> subroutine zqrder(m,n,Q,ldq,R,ldr,j,w,rw)
26
!>
27
!> .. Scalar Arguments ..
28
!> integer m, n, ldq, ldr, j
29
!> ..
30
!> .. Array Arguments ..
31
!> double complex Q(ldq,*)
32
!> double complex R(ldr,*)
33
!> double complex w(*)
34
!> double precision rw(*)
35
!> ..
36
!> \endverbatim
37
!>
38
!> \par Purpose:
39
! =============
40
!> \verbatim
41
!>
42
!> ZQRDER updates a QR factorization after deleting a row. i.e., given
43
!> an m-by-m unitary matrix Q, an m-by-n upper trapezoidal matrix R and
44
!> index j in the range 1:m, ZQRDER updates Q ->Q1 and an R ->
45
!> R1 so that Q1 is again unitary, R1 upper trapezoidal, and Q1*R1 =
46
!> [A(1:j-1,:); A(j+1:m,:)], where A = Q*R. (complex version)
47
!> \endverbatim
48
!>
49
!> \param[in] m
50
!> \verbatim
51
!> m is INTEGER
52
!> The number of rows of the matrix Q. m >= 0.
53
!> \endverbatim
54
!>
55
!> \param[in] n
56
!> \verbatim
57
!> n is INTEGER
58
!> The number of columns of the matrix R. n >= 0.
59
!> \endverbatim
60
!>
61
!> \param[in,out] Q
62
!> \verbatim
63
!> Q is COMPLEX*16 array, dimension (ldq,*)
64
!> On entry, the unitary matrix Q. On exit, the
65
!> updated matrix Q1.
66
!> \endverbatim
67
!>
68
!> \param[in] ldq
69
!> \verbatim
70
!> ldq is INTEGER
71
!> The leading dimension of Q. ldq >= m.
72
!> \endverbatim
73
!>
74
!> \param[in,out] R
75
!> \verbatim
76
!> R is COMPLEX*16 array, dimension (ldr,*)
77
!> On entry, the original matrix R. On exit, the
78
!> updated matrix R1.
79
!> \endverbatim
80
!>
81
!> \param[in] ldr
82
!> \verbatim
83
!> ldr is INTEGER
84
!> The leading dimension of R. ldr >= m.
85
!> \endverbatim
86
!>
87
!> \param[in] j
88
!> \verbatim
89
!> j is INTEGER
90
!> The position of the deleted row. 1 <= j <= m.
91
!> \endverbatim
92
!>
93
!> \param[out] w
94
!> \verbatim
95
!> w is COMPLEX*16 array, dimension (*)
96
!> A workspace vector of size m.
97
!> \endverbatim
98
!>
99
!> \param[out] rw
100
!> \verbatim
101
!> rw is DOUBLE PRECISION array, dimension (*)
102
!> A real workspace vector of size m.
103
!> \endverbatim
104
!>
105
!> \ingroup qrdecomp
106
subroutine
zqrder
(m,n,Q,ldq,R,ldr,j,w,rw)
107
use
iso_fortran_env
108
use
qrupdate_error
109
integer
,
intent(in)
:: m, n, ldq, ldr, j
110
complex(real64)
,
intent(inout)
:: Q(ldq,*), R(ldr,*)
111
complex(real64)
,
intent(out)
:: w(*)
112
real
(real64),
intent(out)
:: rw(*)
113
external
zcopy,zqrtv1,zqrot,zqrqh
114
integer
info,i,k
115
! quick return if possible.
116
if
(m == 1)
return
117
! check arguments
118
info = 0
119
if
(m < 1)
then
120
info = 1
121
else
if
(j < 1 .or. j > m)
then
122
info = 7
123
end if
124
if
(info /= 0)
then
125
call
qrupdate_xerror
(
'ZQRDER'
,info)
126
return
127
end if
128
! eliminate Q(j,2:m).
129
do
k = 1,m
130
w(k) = conjg(q(j,k))
131
end do
132
call
zqrtv1
(m,w,rw)
133
! apply rotations to Q.
134
call
zqrot
(
'B'
,m,m,q,ldq,rw,w(2))
135
! form Q1.
136
do
k = 1,m-1
137
if
(j > 1)
call
zcopy(j-1,q(1,k+1),1,q(1,k),1)
138
if
(j < m)
call
zcopy(m-j,q(j+1,k+1),1,q(j,k),1)
139
end do
140
! apply rotations to R.
141
call
zqrqh
(m,n,r,ldr,rw,w(2))
142
! form R1.
143
do
k = 1,n
144
do
i = 1,m-1
145
r(i,k) = r(i+1,k)
146
end do
147
end do
148
end subroutine
qrupdate_error::qrupdate_xerror
subroutine qrupdate_xerror(srname, info)
Dispatches error reporting to the handler.
Definition
qrupdate_error.f90:89
zqrot
subroutine zqrot(dir, m, n, q, ldq, c, s)
Applies a sequence of Givens rotations from the right to a matrix.
Definition
zqrot.f90:101
zqrtv1
subroutine zqrtv1(n, u, w)
Generates Givens rotations to eliminate all but the first element of a vector.
Definition
zqrtv1.f90:75
zqrqh
subroutine zqrqh(m, n, r, ldr, c, s)
Converts an upper trapezoidal matrix to upper Hessenberg form.
Definition
zqrqh.f90:86
zqrder
subroutine zqrder(m, n, q, ldq, r, ldr, j, w, rw)
Updates a QR factorization after deleting a row.
Definition
zqrder.f90:107
qrupdate_error
Module for custom error handling.
Definition
qrupdate_error.f90:24
src
zqrder.f90
Generated by
1.17.0