AngouriMath
AngouriMath.Functions.Quantum
Classes within the AngouriMath.Functions.Quantum namespace
Factorization
Summary
Writing a state as a tensor product where its leading or trailing qubits are in a
definite basis state.
Remarks
|001> + |011> is|0> (x) (|0> + |1>) (x) |1> : the first
and last qubits agree across the whole superposition, so they factor out and only the
middle carries it.
**Which positions agree is not computed here.** It is
FactorOutCommon(AngouriMath.Functions.Algebra.MonoidAlgebra.IBasisOps{`0}), the same call that takes the common
monomial out of a polynomial -- the meet of the support. What is specific to states is
only how the answer is written down, and that division is the whole point of the spine.
**What this does not do.** Only a common *prefix or suffix* is factored, because a ket
says which qubit it describes by its position in the product and there is no notation
here for "the state of qubits 1 and 3". Nor does it find general separability:
(|0> + |1>) (x) (|0> + |1>) has no qubit in a definite state at all,
so the meet is empty and nothing is factored, yet it is a product state. Detecting that
is a rank-one test on the amplitudes across a bipartition -- a different algorithm,
belonging to this file rather than to the spine, and not written yet.
Ket
Summary
A computational basis state: a fixed-width word over {0, 1}, with
Free marking a position that has been factored out.
Remarks
Compared by value, which SparseTerms`1 requires -- keyed on a
reference-equal basis it would silently stop collecting like terms.
KetOps
Summary
The monoid and lattice structure on kets: the tensor product joins them, and the meet
keeps a position only where both agree.
Remarks
The alphabet is unordered, so this is the meet in a product of *flat* lattices -- which
is the only place it differs from a polynomial's exponent vector, where the meet is a
componentwise minimum in a product of chains. Everything else about factoring is shared.
QuantumState
Summary
Reading a quantum state out of an ordinary expression, and writing one back.
Remarks
**A state is not a new kind of node.** A ket is writtenapply(ket, 0, 1) -- an
application of an undeclared name, which the library already understands -- so a state
is an ordinary sum of products and everything that reads expressions reads it. That is
not only tidy: it is whya|x> + b|x> = (a+b)|x> and0|x> = 0 need no code here at all.Simplify collects like terms over an opaque
application already, and it factors the amplitude out of a Bell state without being
told what one is.
The cost of the choice is that ket is a name rather than a type: nothing stops
apply(ket, 5, 7) , and a caller with their own variable calledket will
collide with it. A dedicated node would close both and would forfeit everything in the
paragraph above, so the loose reading is taken deliberately and is reversible.
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online