qrupdate-ng 1.2.0
Loading...
Searching...
No Matches
zqrtv1.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 Generates Givens rotations to eliminate all but the first element of a vector.
21!>
22!> \par Definition:
23! =============
24!> \verbatim
25!> subroutine zqrtv1(n,u,w)
26!>
27!> .. Scalar Arguments ..
28!> integer n
29!> ..
30!> .. Array Arguments ..
31!> double complex u(*)
32!> double precision w(*)
33!> ..
34!> \endverbatim
35!>
36!> \par Purpose:
37! =============
38!> \verbatim
39!>
40!> ZQRTV1 generates a sequence of n-1 Givens rotations that
41!> eliminate all but the first element of a double complex
42!> vector u. On entry, u contains the vector to be reduced.
43!> On exit, u(1) contains the remaining element, u(2:n) contains
44!> the rotation sines, and w contains the rotation cosines.
45!>
46!> The rotations are generated from the bottom up, so that the
47!> first rotation eliminates u(n), the second eliminates u(n-1),
48!> and so on.
49!> \endverbatim
50!>
51!> \param[in] n
52!> \verbatim
53!> n is INTEGER
54!> The length of the vector u. If n <= 0, the subroutine
55!> returns immediately without modification.
56!> \endverbatim
57!>
58!> \param[in,out] u
59!> \verbatim
60!> u is COMPLEX*16 array, dimension (n)
61!> On entry, the vector to be reduced. On exit, u(1)
62!> contains the remaining element, and u(2:n) contains
63!> the sine parts of the Givens rotations.
64!> \endverbatim
65!>
66!> \param[out] w
67!> \verbatim
68!> w is DOUBLE PRECISION array, dimension (n)
69!> On exit, w contains the cosine parts of the Givens
70!> rotations.
71!> \endverbatim
72!>
73!> \ingroup givens
74subroutine zqrtv1(n,u,w)
75 use iso_fortran_env
76 integer, intent(in) :: n
77 complex(real64), intent(inout) :: u(*)
78 real(real64), intent(out) :: w(*)
79 external zlartg
80 complex(real64) rr,t
81 integer i
82 ! quick return if possible.
83 if (n <= 0) return
84 rr = u(n)
85 do i = n-1,1,-1
86 call zlartg(u(i),rr,w(i),u(i+1),t)
87 rr = t
88 end do
89 u(1) = rr
90end subroutine
subroutine zqrtv1(n, u, w)
Generates Givens rotations to eliminate all but the first element of a vector.
Definition zqrtv1.f90:75