qrupdate-ng
1.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
dqrqh.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 Converts an upper trapezoidal matrix to upper Hessenberg form.
21
!>
22
!> \par Definition:
23
! =============
24
!> \verbatim
25
!> subroutine dqrqh(m,n,R,ldr,c,s)
26
!>
27
!> .. Scalar Arguments ..
28
!> integer m, n, ldr
29
!> ..
30
!> .. Array Arguments ..
31
!> double precision R(ldr,*)
32
!> double precision c(*)
33
!> double precision s(*)
34
!> ..
35
!> \endverbatim
36
!>
37
!> \par Purpose:
38
! =============
39
!> \verbatim
40
!>
41
!> DQRQH brings an upper trapezoidal matrix R into upper Hessenberg form
42
!> using min(m-1,n) Givens rotations. (real version)
43
!> \endverbatim
44
!>
45
!> \param[in] m
46
!> \verbatim
47
!> m is INTEGER
48
!> The number of rows of the matrix R. m >= 0.
49
!> \endverbatim
50
!>
51
!> \param[in] n
52
!> \verbatim
53
!> n is INTEGER
54
!> The number of columns of the matrix R. n >= 0.
55
!> \endverbatim
56
!>
57
!> \param[in,out] R
58
!> \verbatim
59
!> R is DOUBLE PRECISION array, dimension (ldr,*)
60
!> On entry, the upper Hessenberg matrix R. On exit,
61
!> the updated upper trapezoidal matrix.
62
!> \endverbatim
63
!>
64
!> \param[in] ldr
65
!> \verbatim
66
!> ldr is INTEGER
67
!> The leading dimension of R. ldr >= m.
68
!> \endverbatim
69
!>
70
!> \param[in] c
71
!> \verbatim
72
!> c is DOUBLE PRECISION array, dimension (*)
73
!> The rotation cosines. Must contain at least
74
!> min(m-1,n) elements.
75
!> \endverbatim
76
!>
77
!> \param[in] s
78
!> \verbatim
79
!> s is DOUBLE PRECISION array, dimension (*)
80
!> The rotation sines. Must contain at least
81
!> min(m-1,n) elements.
82
!> \endverbatim
83
!>
84
!> \ingroup qrdecomp
85
subroutine
dqrqh
(m,n,R,ldr,c,s)
86
use
iso_fortran_env
87
use
qrupdate_error
88
integer
,
intent(in)
:: m, n, ldr
89
real
(real64),
intent(inout)
:: R(ldr,*)
90
real
(real64),
intent(in)
:: c(*)
91
real
(real64),
intent(in)
:: s(*)
92
real
(real64) t
93
integer
info,i,ii,j
94
! quick return if possible.
95
if
(m == 0 .or. m == 1 .or. n == 0)
return
96
! check arguments.
97
info = 0
98
if
(m < 0)
then
99
info = 1
100
else
if
(n < 0)
then
101
info = 2
102
else
if
(ldr < m)
then
103
info = 4
104
end if
105
if
(info /= 0)
then
106
call
qrupdate_xerror
(
'DQRQH'
,info)
107
return
108
end if
109
do
i = 1,n
110
ii = min(m-1,i)
111
! apply stored rotations, column-wise
112
t = r(ii+1,i)
113
do
j = ii,1,-1
114
r(j+1,i) = c(j)*t - s(j)*r(j,i)
115
t = c(j)*r(j,i) + s(j)*t
116
end do
117
r(1,i) = t
118
end do
119
end subroutine
qrupdate_error::qrupdate_xerror
subroutine qrupdate_xerror(srname, info)
Dispatches error reporting to the handler.
Definition
qrupdate_error.f90:89
dqrqh
subroutine dqrqh(m, n, r, ldr, c, s)
Converts an upper trapezoidal matrix to upper Hessenberg form.
Definition
dqrqh.f90:86
qrupdate_error
Module for custom error handling.
Definition
qrupdate_error.f90:24
src
dqrqh.f90
Generated by
1.17.0