quirk_json_to_circuit: Quirk json to circuit

Description Usage Arguments Value Raises See Also

View source: R/Importing_Exporting.R

Description

Constructs a Cirq circuit from Quirk's JSON format.

Usage

1
2
3
4
5
6
7
quirk_json_to_circuit(
  data,
  qubits,
  extra_cell_makers,
  quirk_url,
  max_operation_count
)

Arguments

data

Data parsed from quirk's JSON representation.

qubits

Qubits to use in the circuit. See quirk_url_to_circuit.

extra_cell_makers

Non-standard Quirk cells to accept. See quirk_url_to_circuit.

quirk_url

If given, the original URL from which the JSON was parsed, as described in quirk_url_to_circuit.

max_operation_count

If the number of operations in the circuit would exceed this value, the method raises a ValueError instead of attempting to construct the circuit. This is important to specify for servers parsing unknown input, because Quirk’s format allows for a billion laughs attack in the form of nested custom gates.

Value

The parsed circuit.

Raises

ValueError: Invalid circuit URL, or circuit would be larger than 'max_operations_count'.

See Also

Other Importing and Exporting: quirk_url_to_circuit()


henry090/Cirq documentation built on June 13, 2020, 1:28 a.m.