cirq.ops.ProjectorString

projector_dict A python dictionary mapping from cirq.Qid to integers. A key value pair represents the desired computational basis state for that qubit.
coefficient Initial scalar coefficient. Defaults to 1.

coefficient

projector_dict

Methods

expectation_from_density_matrix

View source

Expectation of the projection from a density matrix.

Computes the expectation value of this ProjectorString on the provided state.

Args
state An array representing a valid density matrix.
qubit_map A map from all qubits used in this ProjectorString to the indices of the qubits that state_vector is defined over.

Returns
The expectation value of the input state.

expectation_from_state_vector

View source

Expectation of the projection from a state vector.

Computes the expectation value of this ProjectorString on the provided state vector.

Args
state_vector An array representing a valid state vector.
qubit_map A map from all qubits used in this ProjectorString to the indices of the qubits that state_vector is defined over.

Returns
The expectation value of the input state.

matrix

View source

Returns the matrix of self in computational basis of qubits.

Args
projector_qids Ordered collection of qubits that determine the subspace in which the matrix representation of the ProjectorString is to be computed. Qbits absent from self.qubits are acted on by the identity. Defaults to the qubits of the projector_dict.

Returns
A sparse matrix that is the projection in the specified basis.

__eq__

View source

__ne__

View source