> On 12/12/2018 9:36 AM, Wolfman Jack wrote:
>> So far, I've been unable to find it. Quite annoyingly, compiling the
>> HTRIDI subroutine with -Wall -Wextra -pedantic still gives no warning.
>>
I have spent some more time looking at the aliasing problems in Eispack. I
find that the aliasing occurs only in the test drivers, not in the library
itself. In most cases, an easy fix is to provide an otherwise not-in-use
scratch array as a replacement for one of the actual arguments, such as
using 'e' and 'e2' in place of 'e' and 'e'. In a few other cases, in the
call surround an aliased scalar argument by '(' and ')'.
In addition to the aliasing problem discussed in this thread, there exists
a defective code section in many of the test problems.
There is a code segment that computes the mean of the absolute values of
the elements of a double precision array, and then scans the array to find
the first element that is less than the just computed mean. The comment in
the code says that the DO loop used for the scan will never complete.
Unfortunately, this is not true on my Windows PC and the few Fortran
compilers on it; the DO loop goes to completion, and the next memory
location after the end of the array gets accessed and the undefined value
there is used subsequently.
Here is the typical code fragment, which you can locate in the "*test.f"
files in the Netlib Eispack/ex directory by searching for the string "THIS
LOOP WILL NEVER BE COMPLETED".
sumz = 0.0d0
do l = 1, n
sumz = sumz + abs(z(l,i))
end do
nrm(i) = sumz
if (sumz==0.0d0) go to 100
! ..........THIS LOOP WILL NEVER BE COMPLETED SINCE THERE
! WILL ALWAYS EXIST AN ELEMENT IN THE VECTOR Z(I)
! LARGER THAN !!Z(I)!!/N..........
do l = 1, n
if (abs(z(l,i))>=nrm(i)/n) go to 80
end do
! NOT in EISPACK tests: print *, 'The impossible happened'
80 tnorm = sign(nrm(i), z(l,i))
Here is a test program to disprove the claim regarding the DO loop never
being completed.
program tst
implicit none
double precision x(10), y
integer :: i, n = 10, iy(2), ix(2)
equivalence (iy,y),(ix,x)
!
y=0.0d0
do i=1,n
x(i) = -sqrt(0.5d0)
y = y+abs(x(i))
end do
y = y/n
print 10,ix(2),ix(1),'item-1',iy(2),iy(1),'mean'
10 format(1x,2Z8.8,2x,A)
end program
Because of rounding, the mean of the array, whose elements are all equal
to -sqrt(2d0), is larger than that value in the last bit, as you can see
by running the program.
-- mecej4
> mecej...@nospam.invalid (Replace four by 4, nospam by gmail, invalid
> by com,
> and remove all underscores)
--
S:\mecej4.sig