pdft.coherence.diagonal_tensor_indices

pdft.coherence.diagonal_tensor_indices#

pdft.coherence.diagonal_tensor_indices(basis)[source]#

Indices of the tensors that are diagonal in the computational basis.

These are the compact controlled-phase gates, [[1, 1], [1, e^{i phi}]], whose only freedom is a phase. Freeing exactly these is what preserves mu == 1; see the module docstring.

Read from the basis’s program, not guessed from tensor values: a gate of kind "CP" is applied as a diagonal whatever its entries have become. A basis that is not one of the package’s circuits has no program; for it the tensors’ values decide, as they did for every basis before.

Return type:

list[int]