Mapping of cirq.Qid
to measurement values (with a coefficient) representing a projector.
cirq.ProjectorString(
projector_dict: Dict[cirq.Qid
, int],
coefficient: Union[int, float, complex] = 1
)
Args |
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.
|
Attributes |
coefficient
|
|
projector_dict
|
|
Methods
expectation_from_density_matrix
View source
expectation_from_density_matrix(
state: np.ndarray,
qid_map: Mapping[cirq.Qid
, int]
) -> complex
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.
|
qid_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_from_state_vector(
state_vector: np.ndarray,
qid_map: Mapping[cirq.Qid
, int]
) -> complex
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.
|
qid_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
matrix(
projector_qids: Optional[Iterable[raw_types.Qid]] = None
) -> csr_matrix
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
__eq__(
other: _SupportsValueEquality
) -> bool
__ne__
View source
__ne__(
other: _SupportsValueEquality
) -> bool