SnapshotExpectationValue

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

Snapshot instruction for supported methods of Qasm simulator.

Create an expectation value 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 values [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.duration

Get the duration.

SnapshotExpectationValue.label

Return snapshot label

SnapshotExpectationValue.params

return instruction params.

SnapshotExpectationValue.snapshot_type

Return snapshot type

SnapshotExpectationValue.unit

Get the time unit of duration.

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(circuit)

Defines qubits to snapshot for all snapshot methods

SnapshotExpectationValue.inverse()

Special case.

SnapshotExpectationValue.is_parameterized()

Return True .IFF.

SnapshotExpectationValue.mirror()

DEPRECATED: use instruction.reverse_ops().

SnapshotExpectationValue.qasm()

Return a default OpenQASM string for the instruction.

SnapshotExpectationValue.repeat(n)

Creates an instruction with gate repeated n amount of times.

SnapshotExpectationValue.reverse_ops()

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

SnapshotExpectationValue.validate_parameter(…)

Instruction parameters has no validation or normalization.