Skip to content

Snowflurry

Snowflurry is an open-source quantum computing library developed in Julia by Anyon Systems that allows users to build, simulate, and execute quantum circuits. A related library called SnowflurryPlots allows for visualizing simulation results in a bar diagram. Useful for exploring quantum computing, its features are available in the documentation, and the installation guide is available on the GitHub page. Similar to the PennyLane library, Snowflurry can be used to run quantum circuits on the MonarQ quantum computer.

Installation

The quantum computer simulator with Snowflurry is available on all our clusters. The Julia programming language must be loaded before accessing Snowflurry with the command:

module load julia

Next, the Julia programming interface is invoked, and the Snowflurry quantum library is loaded (approximately 5-10 minutes) with the following commands:

julia
import Pkg
Pkg.add(url="https://github.com/SnowflurrySDK/Snowflurry.jl", rev="main")
Pkg.add(url="https://github.com/SnowflurrySDK/SnowflurryPlots.jl", rev="main")
using Snowflurry

Quantum logic gates and commands are described in the Snowflurry documentation.

Example Usage: Bell States

Bell states are maximally entangled two-qubit states. Two simple examples of quantum phenomena are superposition and entanglement. The Snowflurry library allows for constructing the first Bell state as follows:

using Snowflurry
circuit=QuantumCircuit(qubit_count=2);
push!(circuit,hadamard(1));
push!(circuit,control_x(1,2));
print(circuit)

# Expected Output:
# Quantum Circuit Object:
#    qubit_count: 2
# q[1]:──H────*──
#             ¦
# q[2]:───────X──

In the code section above, the Hadamard gate creates an equal superposition of |0⟩ and |1⟩ on the first qubit, while the CNOT gate (controlled-X gate) creates entanglement between the two qubits. This results in an equal superposition of the |00⟩ and |11⟩ states, which is the first Bell state. The simulate function allows for simulating the exact state of the system.

state = simulate(circuit)
print(state)

# Expected Output:
# 4-element Ket{ComplexF64}:
# 0.7071067811865475 + 0.0im
# 0.0 + 0.0im
# 0.0 + 0.0im
# 0.7071067811865475 + 0.0im

To perform a measurement, the readout operation allows specifying which qubits will be measured. The plot_histogram function from the SnowflurryPlots library allows for visualizing the results.

```julia using SnowflurryPlots push!(circuit, readout(1,1), readout(2,2)) plot_histogram(circuit,1000)