diff options
| author | tony mancill <tmancill@debian.org> | 2026-04-12 08:46:47 -0700 |
|---|---|---|
| committer | tony mancill <tmancill@debian.org> | 2026-04-12 08:46:47 -0700 |
| commit | cd2dad3bc7ae0ee0a18b7b20a945009362ec3851 (patch) | |
| tree | 5a622ec4193e9bc899f6499f936848a661be29cb /lib/code426.f90 | |
| parent | 558c0b9d6ecf70c5222e2069ece1fea3656c75d7 (diff) | |
| parent | 291b3817bf0c7a742e9e17d42c94fc8c9530e40d (diff) | |
Merge branch 'debian/latest' into debian/trixie-backports
Diffstat (limited to 'lib/code426.f90')
| -rw-r--r--[-rwxr-xr-x] | lib/code426.f90 | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/lib/code426.f90 b/lib/code426.f90 index 703a89a4..111c5492 100755..100644 --- a/lib/code426.f90 +++ b/lib/code426.f90 @@ -1,62 +1,62 @@ -program code426
-
- parameter (MZ=26) !Number of 4-FSK symbols
- parameter (JZMAX=64) !Desired number of codewords
- integer ic(MZ,JZMAX),icsave(MZ)
- real c(MZ)
- character*12 arg
-
- nargs=iargc()
- if(nargs.ne.2) then
- print*,'Usage: code426 <nmsgs> <iters>'
- print*,'Example: code426 64 10000000'
- go to 999
- endif
- call getarg(1,arg)
- read(arg,*) nmsgs
- call getarg(2,arg)
- read(arg,*) iters
-
- call init_random_seed()
-
- open(13,file='code426.out',status='unknown')
-
- write(*,1002) nmsgs,iters
- write(13,1002) nmsgs,iters
-1002 format('Nmsgs:',i4,' Iters:',i10/(66('-')))
-
- do i=1,MZ !Create 4 mutually orthogonal codewords
- ic(i,1)=mod(i-1,4)
- ic(i,2)=mod(i,4)
- ic(i,3)=mod(i+1,4)
- ic(i,4)=mod(i+2,4)
- enddo
-
- do j=1,4 !Write them out
- write(*,1000) j,MZ,ic(1:MZ,j)
- write(13,1000) j,MZ,ic(1:MZ,j)
-1000 format(2i5,3x,26i2)
- enddo
-
- do j=5,nmsgs !Find codewords up to j=nmsgs with maximum
- npk=0 !distance from all the rest
- do i=1,iters
- call random_number(c) !Generate a random codeword candidate
- ic(1:MZ,j)=int(4*c) !Convert real to integer
-! nd=MZ
-! do k=1,j-1 !Test candidate against all others in list
-! n=count(ic(1:MZ,j).ne.ic(1:MZ,k))
-! nd=min(n,nd)
-! enddo
- call dist426(ic,j,mind)
- if(mind.gt.npk) then
- npk=mind
- icsave=ic(1:MZ,j) !Best candidate so far, save it
-! if(npk.ge.19) exit !It won't get any better...
- endif
- enddo
- write(*,1000) j,npk,ic(1:MZ,j)
- write(13,1000) j,npk,ic(1:MZ,j)
- enddo
-
-999 end program code426
+program code426 + + parameter (MZ=26) !Number of 4-FSK symbols + parameter (JZMAX=64) !Desired number of codewords + integer ic(MZ,JZMAX),icsave(MZ) + real c(MZ) + character*12 arg + + nargs=iargc() + if(nargs.ne.2) then + print*,'Usage: code426 <nmsgs> <iters>' + print*,'Example: code426 64 10000000' + go to 999 + endif + call getarg(1,arg) + read(arg,*) nmsgs + call getarg(2,arg) + read(arg,*) iters + + call init_random_seed() + + open(13,file='code426.out',status='unknown') + + write(*,1002) nmsgs,iters + write(13,1002) nmsgs,iters +1002 format('Nmsgs:',i4,' Iters:',i10/(66('-'))) + + do i=1,MZ !Create 4 mutually orthogonal codewords + ic(i,1)=mod(i-1,4) + ic(i,2)=mod(i,4) + ic(i,3)=mod(i+1,4) + ic(i,4)=mod(i+2,4) + enddo + + do j=1,4 !Write them out + write(*,1000) j,MZ,ic(1:MZ,j) + write(13,1000) j,MZ,ic(1:MZ,j) +1000 format(2i5,3x,26i2) + enddo + + do j=5,nmsgs !Find codewords up to j=nmsgs with maximum + npk=0 !distance from all the rest + do i=1,iters + call random_number(c) !Generate a random codeword candidate + ic(1:MZ,j)=int(4*c) !Convert real to integer +! nd=MZ +! do k=1,j-1 !Test candidate against all others in list +! n=count(ic(1:MZ,j).ne.ic(1:MZ,k)) +! nd=min(n,nd) +! enddo + call dist426(ic,j,mind) + if(mind.gt.npk) then + npk=mind + icsave=ic(1:MZ,j) !Best candidate so far, save it +! if(npk.ge.19) exit !It won't get any better... + endif + enddo + write(*,1000) j,npk,ic(1:MZ,j) + write(13,1000) j,npk,ic(1:MZ,j) + enddo + +999 end program code426 |
