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