sf.circuitdrawer.Circuit¶
-
class
Circuit(wires)[source]¶ Bases:
objectRepresents a quantum circuit that can be compiled to tex format.
- Parameters
wires (int) – the number of quantum wires or subsystems to use in the circuit diagram.
Methods
compile_document([tex_dir])Compiles latex documents.
Writes current circuit to document.
parse_op(op)Transforms a Strawberry Fields operator object to a latex qcircuit gate.
-
compile_document(tex_dir='./circuit_tex')[source]¶ Compiles latex documents.
- Parameters
tex_dir (str) – relative directory for latex document output.
- Returns
the file path of the resulting latex document.
- Return type
str
-
dump_to_document()[source]¶ Writes current circuit to document.
- Returns
latex document string.
- Return type
str
-
parse_op(op)[source]¶ Transforms a Strawberry Fields operator object to a latex qcircuit gate.
- Parameters
op (strawberryfields.ops.Gate) – the Strawberry Fields operator object.
- Raises
UnsupportedGateException – if the operator is not supported by the circuit drawer module.
ModeMismatchException – if the operator is interpreted as an n-mode gate but is applied to a number of modes != n.