qrupdate-ng
1.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
zqrot.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 Applies a sequence of Givens rotations from the right to a matrix.
21
!>
22
!> \par Definition:
23
! =============
24
!> \verbatim
25
!> subroutine zqrot(dir,m,n,Q,ldq,c,s)
26
!>
27
!> .. Scalar Arguments ..
28
!> character dir
29
!> integer m, n, ldq
30
!> ..
31
!> .. Array Arguments ..
32
!> double complex Q(ldq,*)
33
!> double precision c(*)
34
!> double complex s(*)
35
!> ..
36
!> \endverbatim
37
!>
38
!> \par Purpose:
39
! =============
40
!> \verbatim
41
!>
42
!> ZQROT applies a sequence of Givens rotations from the right
43
!> side to an m-by-n matrix Q. Given a direction indicator
44
!> dir, the rotation cosine and sine vectors c and s, ZQROT
45
!> applies the rotations to Q, updating it in place. If dir
46
!> is 'F' (forward), rotations are applied from the first to
47
!> the last; if dir is 'B' (backward), from the last to the
48
!> first.
49
!> \endverbatim
50
!>
51
!> \param[in] dir
52
!> \verbatim
53
!> dir is CHARACTER
54
!> If 'B' or 'b', rotations are applied backwards
55
!> (from the last to the first). If 'F' or 'f',
56
!> rotations are applied forwards (from the first to
57
!> the last).
58
!> \endverbatim
59
!>
60
!> \param[in] m
61
!> \verbatim
62
!> m is INTEGER
63
!> The number of rows of matrix Q. m >= 0.
64
!> \endverbatim
65
!>
66
!> \param[in] n
67
!> \verbatim
68
!> n is INTEGER
69
!> The number of columns of the matrix Q. n >= 0.
70
!> \endverbatim
71
!>
72
!> \param[in,out] Q
73
!> \verbatim
74
!> Q is COMPLEX*16 array, dimension (ldq,*)
75
!> On entry, the matrix Q. On exit, the updated
76
!> matrix Q1.
77
!> \endverbatim
78
!>
79
!> \param[in] ldq
80
!> \verbatim
81
!> ldq is INTEGER
82
!> The leading dimension of Q. ldq >= m.
83
!> \endverbatim
84
!>
85
!> \param[in] c
86
!> \verbatim
87
!> c is DOUBLE PRECISION array, dimension (*)
88
!> The rotation cosines. Must contain at least
89
!> n-1 elements.
90
!> \endverbatim
91
!>
92
!> \param[in] s
93
!> \verbatim
94
!> s is COMPLEX*16 array, dimension (*)
95
!> The rotation sines. Must contain at least
96
!> n-1 elements.
97
!> \endverbatim
98
!>
99
!> \ingroup givens
100
subroutine
zqrot
(dir,m,n,Q,ldq,c,s)
101
use
iso_fortran_env
102
use
qrupdate_error
103
use
qrupdate_blas
104
character
,
intent(in)
:: dir
105
integer
,
intent(in)
:: m, n, ldq
106
complex(real64)
,
intent(inout)
:: Q(ldq,*)
107
real
(real64),
intent(in)
:: c(*)
108
complex(real64)
,
intent(in)
:: s(*)
109
external
zrot
110
logical
fwd
111
integer
info,i
112
! quick return if possible.
113
if
(m == 0 .or. n == 0 .or. n == 1)
return
114
! check arguments.
115
info = 0
116
fwd =
lsame
(dir,
'F'
)
117
if
(.not.(fwd .or.
lsame
(dir,
'B'
)))
then
118
info = 1
119
else
if
(m < 0)
then
120
info = 2
121
else
if
(n < 0)
then
122
info = 3
123
else
if
(ldq < m)
then
124
info = 5
125
end if
126
if
(info /= 0)
then
127
call
qrupdate_xerror
(
'ZQROT'
,info)
128
return
129
end if
130
if
(fwd)
then
131
do
i = 1,n-1
132
call
zrot(m,q(1,i),1,q(1,i+1),1,c(i),conjg(s(i)))
133
end do
134
else
135
do
i = n-1,1,-1
136
call
zrot(m,q(1,i),1,q(1,i+1),1,c(i),conjg(s(i)))
137
end do
138
end if
139
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
qrupdate_blas
Definition
qrupdate_blas.f90:25
qrupdate_blas::lsame
logical function lsame(ca, cb)
Definition
qrupdate_blas.f90:75
qrupdate_error
Module for custom error handling.
Definition
qrupdate_error.f90:24
src
zqrot.f90
Generated by
1.17.0