Commit ab33be23 authored by Yannick Ulrich's avatar Yannick Ulrich

Made long test more user friendly

parent 8d03f863
......@@ -32,6 +32,9 @@ PROGRAM TEST
call do_timing_tests(5)
call do_high_weight_tests
#endif
#ifdef LONG_TEST
call do_long_test
#endif
#endif
#endif
......@@ -42,7 +45,6 @@ PROGRAM TEST
stop 1
end if
stop
call do_long_test
CONTAINS
......@@ -655,6 +657,7 @@ CONTAINS
end subroutine
#endif
#ifdef LONG_TEST
SUBROUTINE DO_LONG_TEST
#if KINDREAL==16
......@@ -670,16 +673,18 @@ CONTAINS
type(inum), dimension(nzero+nieps+ncmpl) :: basis
type(inum), dimension(size(perweight)) :: args
type(inum), parameter :: ione = inum((1._prec,0._prec), di0)
integer i, j, w, seed
integer i, j, w, seed, oldseed
integer(kind=1) i0
real(kind=prec) :: v, maxd
complex(kind=prec) :: ans(2)
complex(kind=8) :: geval
character,parameter :: cr = achar(13)
maxd=0._prec
seed = 112312
tol = 0.01
open(unit=9, action='write', form='unformatted', file="long-test.txt")
basis(1:nzero) = izero
do i=nzero+1,nzero+nieps
......@@ -697,8 +702,9 @@ CONTAINS
enddo
do w=1,size(perweight)
print*,"Testing ",perweight(w)," GPLs with w=",w
do i=1,perweight(w)
oldseed = seed
write( * , 900, advance='no' ) cr, i, perweight(w), w
args(1:w) = basis((/ (1+int(size(basis)*ran2(seed)),j=1,w) /))
#if KINDREAL==16
ans(1) = cmplx(geval(inum2inum([args(1:w),ione]), w+1),kind=prec)
......@@ -706,20 +712,29 @@ CONTAINS
ans(1) = cmplx(geval([args(1:w),ione], w+1),kind=prec)
#endif
ans(2) = G(args(1:w),ione)
write(9) w,i,oldseed, abs(ans(1)-ans(2))
if(abs(ans(1)-ans(2)) > maxd) maxd = abs(ans(1)-ans(2))
if(abs(ans(1)-ans(2)) > tol) goto 123
enddo
print*,' done. largest=',maxd
maxd=0.
enddo
print*,maxd
close(9)
return
123 continue
print*,"Failed with delta",abs(ans(1)-ans(2))
print*,"Offending G was",args(1:w)
print*,ans
close(9)
900 FORMAT(a , 'Testing ',i5,'/',i5,' GPLs with w=',i1)
END SUBROUTINE
#endif
FUNCTION RAN2(randy)
! This is the usual "random"
......
  • The file generated by this can be read using

    stream = OpenRead["~/scratch/long-test-01234.bin", BinaryFormat -> True];
    data = First@Last@Reap[While[True,
          len = BinaryRead[stream, "UnsignedInteger32"]; 
          If[len === EndOfFile, Break[]];
          Sow[BinaryRead[stream, {"Integer32", "Integer32", "Integer32", "Real64"}]];
          len == BinaryRead[stream, "UnsignedInteger32"];
    ]];
    Close[stream]

    Combine this with a473e15f (comment 13644) to analyse data

    SortBy[
     Function[{w, i, seed, del},
       basis[[ 1 + Floor[Length[basis] Ran2[Range[w], seed]] ]] -> del
       ] @@@ data,
     Last
     ]
    Edited by Yannick Ulrich
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment