SND@LHC Software
Loading...
Searching...
No Matches
minresqlpblasmodule Module Reference

Functions/Subroutines

real(dp) function, public ddot (n, dx, incx, dy, incy)
 DDOT forms the dot product of two vectors.
 
real(dp) function, public dnrm2 (n, x, incx)
 DNRM2 returns the euclidean norm of a vector.
 

Function/Subroutine Documentation

◆ ddot()

real(dp) function, public minresqlpblasmodule::ddot ( integer(ip), intent(in)  n,
real(dp), dimension(*), intent(in)  dx,
integer(ip), intent(in)  incx,
real(dp), dimension(*), intent(in)  dy,
integer(ip), intent(in)  incy 
)

DDOT forms the dot product of two vectors.

Definition at line 87 of file minresqlpBlasModule.f90.

88
89 implicit none
90 integer(ip), intent(in) :: n,incx,incy
91 real(dp), intent(in) :: dx(*),dy(*)
92
93 real(dp) :: dtemp
94 integer(ip) :: i,ix,iy,m
95
96 ddot = zero
97 dtemp = zero
98 if ( n <= 0 ) then
99 return
100 end if
101
102! Code for unequal increments or equal increments
103! not equal to 1.
104
105 if ( incx /= 1 .or. incy /= 1 ) then
106
107 if ( 0 <= incx ) then
108 ix = 1
109 else
110 ix = ( - n + 1 ) * incx + 1
111 end if
112
113 if ( 0 <= incy ) then
114 iy = 1
115 else
116 iy = ( - n + 1 ) * incy + 1
117 end if
118
119 do i = 1, n
120 dtemp = dtemp + dx(ix) * dy(iy)
121 ix = ix + incx
122 iy = iy + incy
123 end do
124
125! Code for both increments equal to 1.
126
127 else
128
129 m = mod( n, 5 )
130
131 do i = 1, m
132 dtemp = dtemp + dx(i) * dy(i)
133 end do
134
135 do i = m+1, n, 5
136 dtemp = dtemp + dx(i)*dy(i) + dx(i+1)*dy(i+1) + dx(i+2)*dy(i+2) &
137 + dx(i+3)*dy(i+3) + dx(i+4)*dy(i+4)
138 end do
139
140 end if
141
142 ddot = dtemp
143 return

◆ dnrm2()

real(dp) function, public minresqlpblasmodule::dnrm2 ( integer(ip), intent(in)  n,
real(dp), dimension(*), intent(in)  x,
integer(ip), intent(in)  incx 
)

DNRM2 returns the euclidean norm of a vector.

Definition at line 184 of file minresqlpBlasModule.f90.

185
186 implicit none
187 integer(ip), intent(in) :: n,incx
188 real(dp), intent(in) :: x(*)
189
190 integer(ip) :: ix
191 real(dp) :: ssq,absxi,norm,scale
192
193 if ( n < 1 .or. incx < 1 ) then
194 norm = zero
195 else if ( n == 1 ) then
196 norm = abs( x(1) )
197 else
198 scale = zero
199 ssq = one
200
201 do ix = 1, 1 + ( n - 1 )*incx, incx
202 if ( x(ix) /= zero ) then
203 absxi = abs( x(ix) )
204 if ( scale < absxi ) then
205 ssq = 1_dp + ssq * ( scale / absxi )**2
206 scale = absxi
207 else
208 ssq = ssq + ( absxi / scale )**2
209 end if
210 end if
211 end do
212 norm = scale * sqrt( ssq )
213 end if
214
215 dnrm2 = norm
216 return