95 points · by stncls · 5y ago · 25 comments
The methods proposed are very varied in nature: blocked algorithms, x87 80-bit arithmetic, AVX2/ARMv8-A fused multiply-add (FMA) operations, and probabilistic bounds.
While the article is otherwise very good, I am unsure about one of those in 2021: 80-bit arithmetic. The corresponding x87 instructions are deprecated by Intel, and their performance is disastrous. For example, the complex algorithms implemented in software by glibc to compute transcendental functions (sin, cos, exp, ...) are faster and more accurate than their single instruction x87 FPU counterparts (FSIN, FCOS, ...)!
I would be very curious to see, in a few algorithms, a comparison of x87 arithmetic with double-doubles and even low-precision MPFR. MPFR, by the way, may have its place here if we're talking about sacrificing some performance for higher precision.
For example, Takahashi for bounded-error on extremely large dot product. Depending on use case even doing a pseudo-Takahashi where you only merge the error back once every N iterations can unblock instruction-level parallelism letting the performance hit be only around 2x relative to naive dot products, but with still effectively the same guarantees.
His point about probabilistic error bounds for roundoff errors is excellent! The usual bounds are worst-case, and assume all roundoff errors complement each other. That doesn't happen in practice: the errors average out -- it's readily observable.
As Higham points out, this means intuitively that error magnitudes go from O(n) to O(sqrt(n)) which is huge for large n. I wasn't aware of his very recent joint work with Theo Mary that proves this under some conditions.
Boolean optimization in contrast, is NP-complete since its equivalent to the knapsack problem (0 for "don't pack the object" and 1 for "do pack the object". Each object has a space it takes up + a value. Optimizing on value is NP-complete). Literally more difficult from a computational perspective than its Real/Complex analogue, and __provably__ so.
I'm enjoying my personal studies into Binary Decision Diagrams: the data-structures that are used in Verilog / VHDL synthesizers, libraries, CPU-design, verification (etc. etc.) to encode boolean truth tables and yes... tackle NP-complete and even #P-complete problems (#P complete is "determine the number of solutions" to an NP complete problem. Knights Tours aren't NP complete but... see the paper for an example of #P-like counting problems: "The Number of Knight's Tours Equals 33,439,123,484,294": https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.45...).
The boolean truth table for a 64x64-bit multiplication is 128-bits of input and 128-bits of output. That's 2^253 bytes of storage under a naive scheme, which is clearly unworkable. Binary Decision Diagrams make it possible to store, compute, and "think" about these functions at a high level. (Ex: counting solutions, finding the 1st solution, combining truth tables together, etc. etc.)
Knuth's TAOCP Volume 4A has been a good introduction to the theory, but Knuth's writing style is so difficult sometimes. I'm probably going to buy a supplemental textbook on the subject...
Probably it is so because in continuous case there is the luxury of having enough points between any other points. In discrete case you are much more constrained, for example, you cannot choose a point between 0 and 1, and what is the length of the diagonal of a binary cube or angle between its two hyper-planes? Sometimes these notions can be naturally defined but in other cases the formal theory is not so natural.
By the way, an interesting question is how complex boolean numbers could be defined (naturally).
Ever work with GF(2^x) extension fields?
For a good practical application of "binary complex numbers" (aka: GF(2^x) extension fields), see Reed Solomon error correction codes. EDIT: NASA's Reed Solomon code tutorial is an excellent, "casual", introduction to the subject. (Very little math theory involved: mostly sticks to the "final math" so to speak, focusing on the Reed Solomon error correction aspects). Once you understand how Reed Solomon codes are used, you can then more easily go into the theory of how it relates to GF extension fields, and how those GF-extension fields are similar to complex numbers made up of 0s and 1s.
Booleans act as a weird sort of field where there's no addition¹ and both ∧ and ∨ act as multiplication operators with F≡0 for ∧ and T≡0 for ∨. From this, you can build up the 3×3 tables for each relation to derive that if we add a third value to the boolean arithmetic, say, i, that
T ∨ i = T
F ∨ i = i
i ∨ i = F
and
F ∧ i = F
T ∧ i = i
i ∧ i = T
No other values are possible without destroying the group operations on ∧ and ∨ since we can't have a multiplication operation between two non-zero values give zero and within the non-zero members of the group, we cannot have repeated elements in any row or column.
———
1. This isn't strictly true since we can actually define two possible addition operators, each associated with ∧ and ∨. The associated addition for ∧ would be exclusive or (A + B = T iff A ≠ B) and the associated addition for ∨ would be if and only if (A + B = T iff A = B). The extension of these groups to include i is left as an exercise for the reader, but yes, there is only one possible solution.
Solved: 'The Problem Is The Solution'
German Comic and hm it is written in a kind of dialect, so ask someone who might speak english (-:
Direct-Link to the ('Parted' Solution):
https://i.ibb.co/cFNMXGn/00422-NEIN-FINAL-Mail.png
https://i.ibb.co/TcCL856/00423-NEIN-FINAL-Mail.png
https://i.ibb.co/7YtGT0n/00424-NEIN-FINAL-Mail.png
regards, (-:
Here is a browser version https://observablehq.com/@tomlarkworthy/mip