pdft.bases.cp_diagonals_view

pdft.bases.cp_diagonals_view#

pdft.bases.cp_diagonals_view = ParameterView(name='cp_diagonals')#

What a trainer moves in place of a basis’s tensors.

read(basis) gives the parameters as a list of arrays, write(basis, params) a copy of the basis that holds them, and manifolds(params) the manifold each one lives on, or None to have it read off their values as classify_manifold does. write is traceable, so a loss differentiates through it and the parameters are trained like any others: the basis and its circuit stay what they are, and whatever the view does not read is not trained.

The package’s views: tensors_view, the tensors themselves, each on the manifold its values put it on (what the trainers move when no view is named); cp_phases_view, one angle per controlled-phase gate (cp_phases); cp_diagonals_view, all four phases of every controlled-phase tensor (cp_diagonals). The last two are free real numbers on EuclideanManifold, read in double precision whatever the precision of the tensors, and written back in the tensors’ own.