|
|
|
|
|
by ktpsns
2497 days ago
|
|
Conditionals actually destroy information. The way they are written does not even matter; Consider the evaluation of this functional pseudocode: min(a,b) := if(a < b, a, b)
Obviously, the evaluation of this function looses information about either a or b. This is of course by intention. But this is incompatible to a closed (quantum) system where information must be preserved.Interestingly (but I think there is no deeper connection), vectorization uses masks to avoid branching. Programmatically, one implements then both branches at the same time, and on a per-data level different operations are performed. A simple pseudo-numpy example would be B[where(A < B)] = A
which should actually read component by component, for
instance, having A and B being matrices,
B_{ij} = A_{ij} if A_{ij} < B_{ij}
B_{ij} else ("no-op")
One can write long programs following this paradigm which frequently excel at performance at GPUs and modern day CPUs (which are actually vector machines). |
|