qrupdate-ng
1.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
zaxcpy.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 Performs scaled conjugate vector addition.
21
!>
22
!> \par Definition:
23
! =============
24
!> \verbatim
25
!> subroutine zaxcpy(n,a,x,incx,y,incy)
26
!>
27
!> .. Scalar Arguments ..
28
!> integer n, incx, incy
29
!> ..
30
!> .. Array Arguments ..
31
!> double complex a, x(*), y(*)
32
!> ..
33
!> \endverbatim
34
!>
35
!> \par Purpose:
36
! =============
37
!> \verbatim
38
!>
39
!> ZAXCPY performs the operation y := y + a * conjg(x), where a is a
40
!> double complex scalar, x is a vector of length n, conjg(x) denotes
41
!> the element-wise complex conjugate of x, and y is a vector of the
42
!> same length. On entry, y contains the existing values; on exit, y
43
!> is overwritten with the result. This is the double precision
44
!> complex analogue of the BLAS zaxpy, with the x argument conjugated
45
!> before scaling.
46
!> \endverbatim
47
!>
48
!> \param[in] n
49
!> \verbatim
50
!> n is INTEGER
51
!> The number of elements in vectors x and y. If n <= 0,
52
!> the subroutine returns immediately without modification.
53
!> \endverbatim
54
!>
55
!> \param[in] a
56
!> \verbatim
57
!> a is COMPLEX*16
58
!> The double complex scalar used to scale the conjugated
59
!> vector conjg(x) before accumulation into y.
60
!> \endverbatim
61
!>
62
!> \param[in] x
63
!> \verbatim
64
!> x is COMPLEX*16 array, dimension (*)
65
!> The vector of length n whose complex conjugate is scaled
66
!> by a and added to y. x is not modified.
67
!> \endverbatim
68
!>
69
!> \param[in] incx
70
!> \verbatim
71
!> incx is INTEGER
72
!> The stride (increment) for elements of x. If incx > 0,
73
!> elements are accessed starting from x(1); if incx < 0,
74
!> elements are accessed starting from
75
!> x(1 + (-n+1)*incx). A value of 1 accesses
76
!> contiguous elements.
77
!> \endverbatim
78
!>
79
!> \param[in,out] y
80
!> \verbatim
81
!> y is COMPLEX*16 array, dimension (*)
82
!> On entry, the vector y of length n. On exit, y is
83
!> overwritten with y + a * conjg(x).
84
!> \endverbatim
85
!>
86
!> \param[in] incy
87
!> \verbatim
88
!> incy is INTEGER
89
!> The stride (increment) for elements of y. If incy > 0,
90
!> elements are accessed starting from y(1); if incy < 0,
91
!> elements are accessed starting from
92
!> y(1 + (-n+1)*incy). A value of 1 accesses
93
!> contiguous elements.
94
!> \endverbatim
95
!> \ingroup aux
96
subroutine
zaxcpy
(n,a,x,incx,y,incy)
97
use
iso_fortran_env
98
integer
,
intent(in)
:: n, incx, incy
99
complex(real64)
,
intent(in)
:: a
100
complex(real64)
,
intent(in)
:: x(*)
101
complex(real64)
,
intent(inout)
:: y(*)
102
integer
i,ix,iy
103
! quick return if possible.
104
if
(n <= 0)
return
105
if
(incx /= 1 .or. incy /= 1)
then
106
! code for unequal increments or equal increments not equal to 1
107
ix = 1
108
iy = 1
109
if
(incx.lt.0) ix = (-n+1)*incx + 1
110
if
(incy.lt.0) iy = (-n+1)*incy + 1
111
do
i = 1,n
112
y(iy) = y(iy) + a*conjg(x(ix))
113
ix = ix + incx
114
iy = iy + incy
115
end do
116
else
117
! code for both increments equal to 1
118
do
i = 1,n
119
y(i) = y(i) + a*conjg(x(i))
120
end do
121
end if
122
end subroutine
zaxcpy
subroutine zaxcpy(n, a, x, incx, y, incy)
Performs scaled conjugate vector addition.
Definition
zaxcpy.f90:97
src
zaxcpy.f90
Generated by
1.17.0