## 2 Materials and Methods
### Algorithm for Constructing Arbitrary-Length HAPI Codes  
In order for HAPI codes to be useful, they must be much longer than only 4 non-zero bits as shown in the example above. A list of shortest-length Golomb rulers (also known as Optimal Golomb rulers) is only known up to order 27 [31]. Hence, we propose the following algorithm to construct arbitrary-length Golomb rulers and associated HAPI codes.  
The algorithm starts with a seed sequence such as \(S=\{2,\ 3,\ 4\}\), the same sequence that was used in the example above. The seed sequence can be any set of intervals such that no intervals or combinations of intervals are repeating. Additional aperiodic intervals are then added to this list for each non-zero bit that needs to be added. To add an additional aperiodic interval \(n\) to append a new data bit with \(n-1\) interposed zeros, we must search for an interval with the following conditions.  
**C1.** The new interval \(n=I_{k+1}\) should not be in the set of pre-existing intervals, \(n\
otin S_{excl}\), where \(S_{excl}=\left\{I,\{\sum_{1}^{i}I_{k}\forall i\in[1,2,\ldots,K]\},\{\sum_{1 }^{k}I_{k-\xi}\forall k\in[1,2,\ldots,K]\}\right\}\) and \(K=|I|\) is the cardinality or size of the set of intervals, \(S=\{I_{k},k\in[1,2,\ldots,K]\}\).  
**C2.** Newly formed intervals (formed when combining the new interval \(n=I_{K+1}\) with other pre-existing intervals) should not be in the set of excluded intervals: \(n+b\
otin S_{excl}\)\(\forall b\in B\), where \(B=\{\sum_{1}^{k}I_{K+1-\xi}\forall k\in[1,K]\}\) is the set of intervals terminating at the right-hand side of the existing sequence.  
The newly added interval should be of minimum possible length for maximum compactness. but this is not essential. We then add the new interval to the ordered set of HAPI intervals \(S\) and update the sets \(S_{excl}\) and \(B\).  
Following these conditions, the proposed algorithm for generating the non-repeating intervals is then:  
Begin with a seed sequence of intervals, such as \(S\) = {2,3,4}.  
Search for a new interval that satisfies the criteria **C1** and **C2** above.  
Add the new interval into the ordered set \(S\) and update the exclusion set \(S_{excl}\) and the terminating set \(B\).  
Iterate steps 1 to 3 until the ordered set \(S\) is of the desired length.  
The only restriction is that for HAPI codes sampled from Hadamard sequences, the desired length should be a power of 2.  
For example, in the case of the 4-bit HAPI code example, the exclusion set \(S_{excl}=\{2,\ 3,\ 4,\ 5,\ 7,\ 9\}\) and the terminating set \(B=\{4,\ 7,\ 9\}\). Hence, if we wanted to add one more non-zero bit and so one more interval to the list, we could choose an interval that is not in \(S_{excl}\), such as 6.  
Once the intervals are generated by the above algorithm, HAPI codes are then constructed by creating vectors of non-zero bits sampled from the different rows or columns of a Hadamard matrix and where the intervals of zeros between the non-zero bits are taken from the generated intervals.  
HAPI codes may have many applications including asynchronous code division multiple access (CDMA) communications and multi-transmitter multi-receiver imaging. Here, we focus on parallel coded synthetic aperture ultrasound imaging.