Dot products with +1, -1 vectors.

 There’s a surprisingly large class of algorithms where the dot product is with a vector whose entries are only 

+1+1 or 1-1, and in all of them you can skip multiplications entirely by turning them into addition/subtraction.

Here are some notable examples and contexts:


1. Walsh–Hadamard Transform (WHT)

  • The Walsh–Hadamard transform uses basis vectors that are sequences of +1+1 and 1-1.

  • Applications:

    • Fast correlation computation

    • Signal compression

    • Spread-spectrum communications

    • Machine learning for binary random projections

  • The fast algorithm is O(n log n) and needs only adds/subtracts (no multiplies).

  • This is basically a "Fourier transform over ±1\pm 1" instead of complex roots of unity.


2. Random Projection / Johnson–Lindenstrauss Lemma

  • In dimensionality reduction, a random projection matrix with entries in {+1,1}\{+1, -1\} can preserve pairwise distances with high probability.

  • Multiplication becomes cheap: just add or subtract coordinates.

  • Used in:

    • Approximate nearest neighbor search

    • Large-scale ML preprocessing

    • Compressed sensing


3. Simhash / Locality-Sensitive Hashing (LSH)

  • Google’s Simhash computes a fingerprint by dotting with random ±1\pm 1 vectors.

  • Since you only need to know the sign of the result, this becomes “count how many adds vs. subtracts.”

  • Very fast for large text or image feature vectors.


4. Certain Neural Network Layers

  • Binary Weight Networks (and Binarized Neural Networks, BNNs) restrict weights to ±1\pm 1.

  • Inference becomes sign-flips + accumulation instead of floating-point multiplications.

  • Huge speed-ups on CPUs and low-power devices.


5. Correlation with Binary Patterns

  • In matched filtering for error-correcting codes or spread-spectrum signals, you often correlate with sequences like Barker codes or Hadamard codes, which are ±1\pm 1.

  • GPS C/A code correlation also fits this model.


6. Combinatorial Optimization / Ising Model

  • The Ising model in physics uses spin variables si{+1,1}s_i \in \{+1, -1\} and interactions JijJ_{ij}.

  • Energy computation involves dot products of spin vectors with ±1\pm 1 entries.

  • Optimization algorithms (e.g., simulated annealing, quantum annealing) exploit the no-multiplication property.


7. XOR as Special Case in Binary Domain

  • In GF(2) coding, if you reinterpret +1+1 as 0 and 1-1 as 1, the dot product mod 2 becomes XOR.

  • This trick shows up in:

    • Fast parity checks

    • Reed–Muller codes

    • Boolean Fourier analysis

Comments

Popular posts from this blog

Neon Bulb Oscillators

23 Circuits you can Build in an Hour - Free Book

Q Multiplier Circuits