From 5815bfe3189788db71f1402ec83135d4bf3e7664 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Wed, 6 Nov 2024 20:22:00 +0000 Subject: [PATCH] build based on f045887 --- dev/.documenter-siteinfo.json | 2 +- dev/gates/index.html | 2 +- dev/index.html | 2 +- dev/internals/index.html | 2 +- dev/pragmas/index.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index bc36133..28c5d28 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-31T16:20:56","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-06T20:21:56","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/gates/index.html b/dev/gates/index.html index 188f104..571f880 100644 --- a/dev/gates/index.html +++ b/dev/gates/index.html @@ -3,4 +3,4 @@ "x"=>BuiltinGateDefinition("x", String[], ["a"], (type="x", arguments=InstructionArgument[], targets=[0], controls=Pair{Int,Int}[], exponent=1.0)), "rx"=>BuiltinGateDefinition("rx", ["θ"], ["a"], (type="rx", arguments=InstructionArgument[θ], targets=[0], controls=Pair{Int,Int}[], exponent=1.0)), )

You can provide this definition to Quasar.jl by updating the reference builtin_gates:

using Quasar
-Quasar.builtin_gates[] = my_builtin_gates
+Quasar.builtin_gates[] = my_builtin_gates diff --git a/dev/index.html b/dev/index.html index 1645269..9594dc3 100644 --- a/dev/index.html +++ b/dev/index.html @@ -11,4 +11,4 @@ ... end -Quasar.builtin_gates[] = my_builtin_generator

A generator function is used here in order to allow visitors to overwrite builtin functions in certain scopes without corrupting the reference definition. If you're writing a package which uses Quasar, the Quasar.builtin_gates[] = my_builtin_generator should be placed in your main module's __init__ function.

+Quasar.builtin_gates[] = my_builtin_generator

A generator function is used here in order to allow visitors to overwrite builtin functions in certain scopes without corrupting the reference definition. If you're writing a package which uses Quasar, the Quasar.builtin_gates[] = my_builtin_generator should be placed in your main module's __init__ function.

diff --git a/dev/internals/index.html b/dev/internals/index.html index 7f0e869..20c94dc 100644 --- a/dev/internals/index.html +++ b/dev/internals/index.html @@ -1,2 +1,2 @@ -Internals · Quasar.jl

Quasar.jl internals

Here we document some of the internal types useful for developers and those extending Quasar.jl with custom gate sets and pragmas.

Quasar.CircuitInstructionType
CircuitInstruction

A NamedTuple representing a circuit instruction (a gate, a noise operation, a timing operation). Fields are:

  • type::String - the name of the operation (e.g. rx)
  • arguments::Vector{InstructionArgument} - arguments, if any, to the operation (e.g. π for an angled gate)
  • targets::Vector{Int} - qubit targets for the operation, including control qubits, if any
  • controls::Vector{Pair{Int, Int}} - control qubits and bit-values for the operation, so that a ctrl @ x 0, 2; could have controls = [0=>1] and negctrl @ x 0, 2; could have controls = [0=>0].
  • exponent::Float64 - exponent to which the operation is raised, if any

CircuitInstructions can be used with a package like StructTypes.jl to build the actual types of your package from these NamedTuples.

source
Quasar.CircuitResultType
CircuitResult

A NamedTuple representing a circuit result (e.g. an expectation value). Fields are:

  • type::Symbol - the name of the result type (e.g. :variance)
  • operator::Vector{Union{String, Matrix{ComplexF64}}} - the operator to measure, if applicable
  • targets::Vector{Int} - qubit targets for the result
  • states::Vector{String} - vector of bitstrings to measure the amplitudes of, if the result type is an :amplitude

CircuitResults can be used with a package like StructTypes.jl to build the actual result objects of your package from these NamedTuples.

source
+Internals · Quasar.jl

Quasar.jl internals

Here we document some of the internal types useful for developers and those extending Quasar.jl with custom gate sets and pragmas.

Quasar.CircuitInstructionType
CircuitInstruction

A NamedTuple representing a circuit instruction (a gate, a noise operation, a timing operation). Fields are:

  • type::String - the name of the operation (e.g. rx)
  • arguments::Vector{InstructionArgument} - arguments, if any, to the operation (e.g. π for an angled gate)
  • targets::Vector{Int} - qubit targets for the operation, including control qubits, if any
  • controls::Vector{Pair{Int, Int}} - control qubits and bit-values for the operation, so that a ctrl @ x 0, 2; could have controls = [0=>1] and negctrl @ x 0, 2; could have controls = [0=>0].
  • exponent::Float64 - exponent to which the operation is raised, if any

CircuitInstructions can be used with a package like StructTypes.jl to build the actual types of your package from these NamedTuples.

source
Quasar.CircuitResultType
CircuitResult

A NamedTuple representing a circuit result (e.g. an expectation value). Fields are:

  • type::Symbol - the name of the result type (e.g. :variance)
  • operator::Vector{Union{String, Matrix{ComplexF64}}} - the operator to measure, if applicable
  • targets::Vector{Int} - qubit targets for the result
  • states::Vector{String} - vector of bitstrings to measure the amplitudes of, if the result type is an :amplitude

CircuitResults can be used with a package like StructTypes.jl to build the actual result objects of your package from these NamedTuples.

source
diff --git a/dev/pragmas/index.html b/dev/pragmas/index.html index 667e1c1..9bfcb8d 100644 --- a/dev/pragmas/index.html +++ b/dev/pragmas/index.html @@ -10,4 +10,4 @@ throw(Quasar.QasmParseError(your_error_message, stack, start, qasm))

Visiting the parsed pragmas

Once you've generated the subtree(s) for your pragma(s), you can then visit them to generate your final instructions and results (if any) for your QASM file. When Quasar.jl's visitor encounters a QasmExpression with a head of :pragma, it will call visit_pragma[](v::AbstractVisitor, expr::QasmExpression). You can then dispatch on the type of pragma, if you support multiple. You can then push CircuitInstructions and CircuitResults to the visitor v.

Loading your functions into Quasar.jl

Similar to custom gate sets, you can let Quasar.jl know about these at module initialization time:

function __init__()
     Quasar.parse_pragma[] = my_parse_pragma
     Quasar.vist_pragma[]  = my_visit_pragma
-end
+end