qrupdate-ng
1.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
cdotu.f90
Go to the documentation of this file.
1
! Copyright (C) 2026 Martin Köhler <koehlerm(AT)mpi-magdeburg.mpg.de>
2
!
3
! This file is part of qrupdate-ng.
4
!
5
! qrupdate is free software; you can redistribute it and/or modify
6
! it under the terms of the GNU General Public License as published by
7
! the Free Software Foundation; either version 3 of the License, or
8
! (at your option) any later version.
9
!
10
! This program is distributed in the hope that it will be useful,
11
! but WITHOUT ANY WARRANTY; without even the implied warranty of
12
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
! GNU General Public License for more details.
14
!
15
! You should have received a copy of the GNU General Public License
16
! along with this software; see the file COPYING. If not, see
17
! <http://www.gnu.org/licenses/>.
18
!
19
!> \brief CDOTU Complex dot product (x**T y version)
20
!
21
!> \par Definition:
22
! ===========
23
!> \verbatim
24
!> SUBROUTINE QRUPDATE_CDOTU(RET, N,CX,INCX,CY,INCY)
25
!>
26
!> .. Scalar Arguments ..
27
!> INTEGER INCX,INCY,N
28
!> COMPLEX(real32) ret
29
!> ..
30
!> .. Array Arguments ..
31
!> COMPLEX(real32) CX(*),CY(*)
32
!> ..
33
!> \endverbatim
34
!
35
!> \par Purpose:
36
! =============
37
!>
38
!> \verbatim
39
!>
40
!> CDOTU forms the dot product of two complex vectors
41
!> CDOTU = X^T * Y
42
!>
43
!> \endverbatim
44
!
45
! Arguments:
46
! ==========
47
!
48
!> \param[out] RET
49
!> \verbatim
50
!> RET is COMPLEX(real32)
51
!> RET contains the dot product.
52
!> \endverbatim
53
!>
54
!> \param[in] N
55
!> \verbatim
56
!> N is INTEGER
57
!> number of elements in input vector(s)
58
!> \endverbatim
59
!>
60
!> \param[in] CX
61
!> \verbatim
62
!> CX is COMPLEX(real32) array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
63
!> \endverbatim
64
!>
65
!> \param[in] INCX
66
!> \verbatim
67
!> INCX is INTEGER
68
!> storage spacing between elements of CX
69
!> \endverbatim
70
!>
71
!> \param[in] CY
72
!> \verbatim
73
!> CY is COMPLEX(real32) array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
74
!> \endverbatim
75
!>
76
!> \param[in] INCY
77
!> \verbatim
78
!> INCY is INTEGER
79
!> storage spacing between elements of CY
80
!> \endverbatim
81
!>
82
!> \remark This routine is equivalent to cdotu from BLAS but invariant with the compiler's Fortran ABI
83
!
84
!
85
!> \ingroup aux
86
! =====================================================================
87
subroutine
qrupdate_cdotu
(ret,n,cx,incx,cy,incy)
88
use
iso_fortran_env
89
implicit none
90
91
! .. scalar arguments ..
92
integer
,
intent(in)
:: incx,incy,n
93
! ..
94
! .. array arguments ..
95
complex(real32)
,
intent(in)
:: cx(*),cy(*)
96
complex(real32)
,
intent(out)
:: ret
97
! ..
98
!
99
! .. local scalars ..
100
complex(real32)
ctemp
101
integer
i,ix,iy
102
! ..
103
ctemp = (0.0,0.0)
104
ret = (0.0,0.0)
105
if
(n.le.0)
return
106
if
(incx.eq.1 .and. incy.eq.1)
then
107
!
108
! code for both increments equal to 1
109
!
110
do
i = 1,n
111
ctemp = ctemp + cx(i)*cy(i)
112
end do
113
else
114
!
115
! code for unequal increments or equal increments
116
! not equal to 1
117
!
118
ix = 1
119
iy = 1
120
if
(incx.lt.0) ix = (-n+1)*incx + 1
121
if
(incy.lt.0) iy = (-n+1)*incy + 1
122
do
i = 1,n
123
ctemp = ctemp + cx(ix)*cy(iy)
124
ix = ix + incx
125
iy = iy + incy
126
end do
127
end if
128
ret = ctemp
129
return
130
!
131
! end of cdotu
132
!
133
end subroutine
qrupdate_cdotu
subroutine qrupdate_cdotu(ret, n, cx, incx, cy, incy)
CDOTU Complex dot product (x**T y version).
Definition
cdotu.f90:88
src
cdotu.f90
Generated by
1.17.0