pdft.bases.DCT4Basis#
- class pdft.bases.DCT4Basis(m, n, tensors=None, code=None, inv_code=None, parametrization='o4')[source]#
Bases:
CircuitBasisDCT-IV tensor-network basis: the real-orthogonal, ancilla-free analogue of
QFTBasis.The gates are emitted by
pdft.bases.circuit.dct4.dct4_gates(); at initialization the forward operator is the bit-reversed orthonormal DCT-IV per dimension, and since DCT-IV is self-inverse the basis reconstructs exactly.tensorsholds every gate (the affineR_yrotation layer, the branch Hadamards, the mirror-QCNOT permutations and theDeltasign), each a learnable leaf on the manifold the optimiser picks from its values (U(2) / U(4) / phase). The gate tensors are real to rounding: stored complex128, with a zero imaginary part except in theDeltasign, which isexp(i*pi)and carries1.2e-16. So the operator is the DCT-IV at init, then relaxed, as QFT relaxes within U.Training does not stay real-orthogonal, though. The optimisers amplify that imaginary part: about
1e-2in the tensors after twenty Adam steps on real images. A trainedDCT4Basisis unitary, not real. A basis whose tensors are exactly real, such asRealRichBasis, does stay real.- Parameters:
Methods
__init__(m, n[, tensors, code, inv_code, ...])forward_transform(pic)inverse_transform(pic)conj(tensors)throughinv_code, exactly like Julia'sbasis.inverse_code(conj.(basis.tensors)..., ...).Attributes
freezes_to_blockedimage_sizeinv_tensorsThe tensor list itself.
num_parametersmntensorsprogramcodeinv_codeemit