peropq.unconstrained_variational_unitary

Classes

UnconstrainedVariationalUnitary

class representing the variational unitary ansataz, with no prior constraint on the variational parameters.

Module Contents

class peropq.unconstrained_variational_unitary.UnconstrainedVariationalUnitary

Bases: peropq.variational_unitary.VariationalUnitary

class representing the variational unitary ansataz, with no prior constraint on the variational parameters.

update_theta(new_array)

Update theta.

Parameters:

new_array (numpy.typing.NDArray) – the new array containing the variational parameters. It’s shape must be (R, n_terms).

Return type:

None

flatten_theta(theta)

Returns an input theta as flatten depth*n_terms array. Useful to pass to a minimization function.

Parameters:

theta (numpy.typing.NDArray)

Return type:

numpy.typing.NDArray

unflatten_theta(flat_theta)

Returns the flattened variational parameters as an array with shape (depth,n_terms).

Parameters:

flat_theta (numpy.typing.NDArray)

Return type:

numpy.typing.NDArray

get_flattened_theta()

Return the flatten current variational parameters.

Return type:

numpy.typing.NDArray

get_initial_trotter_vector()

Get the variational parameters corresponding to the Trotterization. Useful to initialize the optimization.

Return type:

numpy.typing.NDArray

set_theta_to_trotter()

Sets the variational parameters to the Trotter parameters.

Return type:

None