%N antmask %F $MIR/src/subs/antennas.for
%D Logical mask of baselines from two antenna lists
%: baselines, antenna
%B
      subroutine antmask (maxant, nant1, nant2, ant1, ant2, blmask)

      implicit none
      integer maxant, nant1, nant2, ant1(maxant), ant2(maxant)
      logical blmask((maxant*(maxant-1))/2)

     Make a logical mask of baselines from two antenna lists.
     The mask is .true. if that baseline can be formed from the
     two antenna lists, oltherwise .false.  The index of the
     mask is computed from:

                   index = SUM_i=1,A1-1 (maxant-i) + (A2-A1)

     which reduces to

                   index = maxant*(A1-1) - (A1*(A1-1)/2) + (A2-A1)

     where MAXANT is the maximum number of antennas possible,
     A1 is antenna 1, A2 is antenna 2, and A1 < A2   

  Input:
    maxant   Maximum number of allowed antennas
    nant1    Number of antennas in list ANT1
    nant2    Number of antennas in list ANT2
    ant1     First list of antennas. 
    ant2     Second list of antennas. 
  Output:
    nblmask  Number of baselines 
    blmask   Mask for baselines.  If nant1=0=nant2, all locations
             are .true. 
