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