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
or , 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 and .
-
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 " instead of complex roots of unity.
2. Random Projection / Johnson–Lindenstrauss Lemma
-
In dimensionality reduction, a random projection matrix with entries in 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 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 .
-
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 .
-
GPS C/A code correlation also fits this model.
6. Combinatorial Optimization / Ising Model
-
The Ising model in physics uses spin variables and interactions .
-
Energy computation involves dot products of spin vectors with 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 as 0 and as 1, the dot product mod 2 becomes XOR.
-
This trick shows up in:
-
Fast parity checks
-
Reed–Muller codes
-
Boolean Fourier analysis
-
Comments
Post a Comment