SnapshotExpectationValue

class SnapshotExpectationValue(label, op, single_shot=False, variance=False)[source]

Snapshot instruction for supported methods of Qasm simulator.

Create a probability snapshot instruction.

Parameters
  • label (str) – the snapshot label.

  • op (Operator) – operator to snapshot.

  • single_shot (bool) – return list for each shot rather than average [Default: False]

  • variance (bool) – compute variance of probabilities [Default: False]

Raises

ExtensionError – if snapshot is invalid.

Attributes

SnapshotExpectationValue.decompositions

Get the decompositions of the instruction from the SessionEquivalenceLibrary.

SnapshotExpectationValue.definition

Return definition in terms of other basic gates.

SnapshotExpectationValue.label

Return snapshot label

SnapshotExpectationValue.params

return instruction params.

SnapshotExpectationValue.snapshot_type

Return snapshot type

Methods

SnapshotExpectationValue.add_decomposition(…)

Add a decomposition of the instruction to the SessionEquivalenceLibrary.

SnapshotExpectationValue.assemble()

Assemble a QasmQobjInstruction for snapshot_expectation_value.

SnapshotExpectationValue.broadcast_arguments(…)

Validation of the arguments.

SnapshotExpectationValue.c_if(classical, val)

Add classical condition on register classical and value val.

SnapshotExpectationValue.copy([name])

Copy of the instruction.

SnapshotExpectationValue.define_snapshot_register(…)

Defines qubits to snapshot for all snapshot methods

SnapshotExpectationValue.inverse()

Special case.

SnapshotExpectationValue.is_parameterized()

Return True .IFF.

SnapshotExpectationValue.mirror()

For a composite instruction, reverse the order of sub-gates.

SnapshotExpectationValue.qasm()

Return a default OpenQASM string for the instruction.

SnapshotExpectationValue.repeat(n)

Creates an instruction with gate repeated n amount of times.