cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c Program to verify Golomb rulers c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c IBM SOFTWARE DISCLAIMER c c grver.f (version 1.1) c Copyright (1998) c International Business Machines Corporation c c Permission to use, copy, modify and distribute this software for c any purpose and without fee is hereby granted, provided that this c copyright and permission notice appear on all copies of the software. c The name of the IBM corporation may not be used in any advertising or c publicity pertaining to the use of the software. IBM makes no c warranty or representations about the suitability of the software c for any purpose. It is provided "AS IS" without any express or c implied warranty, including the implied warranties of merchantability, c fitness for a particular purpose and non-infringement. IBM shall not c be liable for any direct, indirect, special or consequential damages c resulting from the loss of use, data or projects, whether in action c of contract or tort, arising out or in the connection with the use or c performance of this software. c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c Author: James B. Shearer c email: jbs@watson.ibm.com c website: http://www.research.ibm.com/people/s/shearer/ c date: 1998 c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c Version 1.1 (12/11/98) - Renamed variables to conform with c exhaustive search routines. Added nver variable. c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c Version 1.2 ( 3/09/00) - Write nver to unit 6 not unit 5 c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c This program independently verifies that the Golomb rulers c constructed by programs conap.f, conpp.f, grs1.f, grs2.f and grs3.f c are in fact Golomb rulers. c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc parameter (maxn=200) integer*4 idif(maxn*maxn) integer*4 m(maxn) c Initialize count of rulers verified nver=0 c read from unit 1, output unit for conap.f conpp.f grs1.f grs2.f grs3.f c read header line c n is number of marks c k is length of ruler 10 read(1,100)n,k c end of file is marked by a 0 if(n.le.0)go to 60 c check n and k values if(n.gt.maxn)stop "n too large" if(k.gt.maxn*maxn)stop "k too large" if(k.le.0)stop "k too small" 100 format(4i10) c read mark positions read(1,110)(m(j),j=1,n) 110 format(10i6) c check first mark is at 0 if(m(1).ne.0)stop "m(1) not 0" c check mark positions are increasing do 20 j=2,n if(m(j-1).ge.m(j))stop "m not increasing" 20 continue c check length is correct if(m(n).ne.k)stop "m(n) not equal to k" c zero idif array do 30 j=1,k idif(j)=0 30 continue c mark differences do 40 ja=1,n do 41 jb=ja+1,n idif(m(jb)-m(ja))=1 41 continue 40 continue c count differences is=0 do 50 j=1,k is=is+idif(j) 50 continue c verify all differences distinct if(2*is.ne.(n*n-n))stop "indistinct differences" c everything ok, increment count, go read next ruler nver=nver+1 go to 10 c output number of Golomb rulers successfully verified 60 continue write(6,200)nver 200 format(1x,i10,' Golomb rulers verified to be correct.') stop end