Snowflurry/en: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
(Created page with "Snowflurry")
Tags: Mobile edit Mobile web edit
 
No edit summary
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages />
<languages />
<div lang="fr" dir="ltr" class="mw-content-ltr">
[https://github.com/SnowflurrySDK/Snowflurry.jl/ Snowflurry] is an open-source quantum computing library developed in  [[Julia]] by [https://anyonsys.com/ Anyon Systems] that allows you to build, simulate, and run quantum circuits. A related library called [https://github.com/SnowflurrySDK/SnowflurryPlots.jl/ SnowflurryPlots] allows you to visualize the simulation results in a bar chart. Useful to explore quantum computing, its features are described in the [https://snowflurrysdk.github.io/Snowflurry.jl/dev/index.html documentation] and the [https://github.com/SnowflurrySDK/Snowflurry.jl installation guide is available on the GitHub page]. Like the [[PennyLane/en|PennyLane]] library, Snowflurry can be used to run quantum circuits on the [[MonarQ/en|MonarQ]] quantum computer.
== Snowflurry ==
[https://github.com/SnowflurrySDK/Snowflurry.jl/ Snowflurry] est une librairie d'informatique quantique open source développée en [https://julialang.org/ Julia] par [https://anyonsys.com/ Anyon Systems, Inc] qui permet de construire, de simuler et d'exécuter des circuits quantiques.
Une librairie connexe nommée [https://github.com/SnowflurrySDK/SnowflurryPlots.jl/ SnowflurryPlots] permet de visualiser les résultats de la simulation dans un diagramme à bandes. Pratique pour explorer l'informatique quantique, les fonctionnalitées des librairies sont disponibles dans la [https://snowflurrysdk.github.io/Snowflurry.jl/dev/index.html documentation] et le guide d'installation est disponible sur la page [https://github.com/SnowflurrySDK/Snowflurry.jl GitHub]. Tout comme la librairie [[PennyLane]], Snowflurry peut être utilisé pour exécuter des circuits quantiques sur l'ordinateur quantique [[Les services quantiques|MonarQ]].
</div>


<div lang="fr" dir="ltr" class="mw-content-ltr">
== Installation ==
== Installation de Snowflurry ==
The quantum computer simulator with [https://github.com/SnowflurrySDK/Snowflurry.jl Snowflurry] is available on all of our clusters. The [https://julialang.org/ Julia] programming language  must be loaded before accessing Snowflurry.
Le simulateur d'ordinateur quantique avec [https://github.com/SnowflurrySDK/Snowflurry.jl Snowflurry] est accessible sur tous les grappes de l'Alliance. Le langage de programmation [https://julialang.org/ Julia] doit être chargé avant d'avoir accès à Snowflurry avec la commande:
<includeonly> <div class="floatright"> [[File:Question.png|40px|link=https://explainshell.com/explain?cmd={{urlencode:{{{1}}} }}]] </div> <div class="command">{{#tag:syntaxhighlight|{{{prompt|[username@narval ~]$}}} {{{1}}}{{{result|}}}|lang={{{lang|bash}}}}}</div></includeonly><noinclude>
<includeonly> <div class="floatright"> [[File:Question.png|40px|link=https://explainshell.com/explain?cmd={{urlencode:{{{1}}} }}]] </div> <div class="command">{{#tag:syntaxhighlight|{{{prompt|[username@narval ~]$}}} {{{1}}}{{{result|}}}|lang={{{lang|bash}}}}}</div></includeonly><noinclude>
{{Command|module load julia
{{Command|module load julia
|result=}}  
|result=}}  
</noinclude>
</noinclude>
Ensuite, l'interface de programmation Julia est appelée et la bibliothèque quantique de Snowflurry chargée (environ 5-10 minutes) avec les commandes
The Julia programming interface is then called and the Snowflurry quantum library is loaded (in about 5-10 minutes) with the commands
<includeonly> <div class="floatright"> [[File:Question.png|40px|link=https://explainshell.com/explain?cmd={{urlencode:{{{1}}} }}]] </div> <div class="command">{{#tag:syntaxhighlight|{{{prompt|[username@narval ~]$}}} {{{1}}}{{{result|}}}|lang={{{lang|bash}}}}}</div></includeonly><noinclude>
<includeonly> <div class="floatright"> [[File:Question.png|40px|link=https://explainshell.com/explain?cmd={{urlencode:{{{1}}} }}]] </div> <div class="command">{{#tag:syntaxhighlight|{{{prompt|[username@narval ~]$}}} {{{1}}}{{{result|}}}|lang={{{lang|bash}}}}}</div></includeonly><noinclude>
{{Command|julia
{{Command|julia
Line 21: Line 16:
julia> using Snowflurry}}  
julia> using Snowflurry}}  
</noinclude>
</noinclude>
La liste des portes logiques quantiques et des commandes Snowflurry sont décrites dans la [https://snowflurrysdk.github.io/Snowflurry.jl/dev/ documentation de Snowflurry]. <!--Le simulateur quantique de Snowflurry est appelé avec la commande [https://snowflurrysdk.github.io/Snowflurry.jl/dev/tutorials/basics.html#Circuit-Simulation simulate].-->
Quantum logic gates and commands are described in the [https://snowflurrysdk.github.io/Snowflurry.jl/dev/ Snowflurry documentation]. <!--Le simulateur quantique de Snowflurry est appelé avec la commande [https://snowflurrysdk.github.io/Snowflurry.jl/dev/tutorials/basics.html#Circuit-Simulation simulate].-->
</div>


<div lang="fr" dir="ltr" class="mw-content-ltr">
== Use case: Bell states ==
== Exemple d'utilisation: états de Bell ==
Bell states are maximally entangled two-qubit states. They are simple examples of two quantum phenomena: superposition and entanglement. The [https://github.com/SnowflurrySDK/Snowflurry.jl/ Snowflurry] library allows you to construct the first Bell state as follows:
Les états de Bell sont des états à deux qubits maximalement intriqués. Ce sont des exemples simples de  deux phénomènes quantiques: la superposition et l'intrication. La librairie [https://github.com/SnowflurrySDK/Snowflurry.jl/ Snowflurry] permet de construire le premier état de Bell comme suit.
<noinclude>
<noinclude>
{{Command|julia
{{Command|julia
Line 34: Line 27:
julia> push!(circuit,control_x(1,2));
julia> push!(circuit,control_x(1,2));
julia> print(circuit)
julia> print(circuit)
</div>


<div lang="fr" dir="ltr" class="mw-content-ltr">
Quantum Circuit Object:
Quantum Circuit Object:
   qubit_count: 2  
   qubit_count: 2  
Line 44: Line 35:
}}
}}
</noinclude>
</noinclude>
Dans la section de code ci-haut, la porte de Hadamard crée une superposition égale de |0⟩ et |1⟩ sur le premier qubit tandis que la porte CNOT (porte X controllée) crée une intrication entre les deux qubits. On retrouve une superposition égale des états |00⟩ et |11⟩, soit le premier état de Bell. La fonction <code>simulate</code> permet de simuler l'état exact du système.
In the above code section, the Hadamard gate creates an equal superposition of |0⟩ and |1⟩ on the first qubit while the CNOT gate (controlled X gate) creates an entanglement between the two qubits. We find an equal superposition of states |00⟩ and |11⟩, which is the first Bell state. The <code>simulate</code> function allows us to simulate the exact state of the system.
<noinclude>
<noinclude>
   julia> state = simulate(circuit)
   julia> state = simulate(circuit)
Line 54: Line 45:
   0.7071067811865475 + 0.0im
   0.7071067811865475 + 0.0im
</noinclude>
</noinclude>
</div>


<div lang="fr" dir="ltr" class="mw-content-ltr">
The <code>readout</code> operation lets you specify which qubits will be measured. The <code>plot_histogram</code> function from the SnowflurryPlots library allows you to visualize the results.
Pour effectuer une mesure, l'opération <code>readout</code> permet de spécifier quels qubits seront mesurés. La bibliothèque SnowflurryPlots et la fonction <code>plot_histogram</code> permettent de visualiser les résultats.
<noinclude>
<noinclude>
{{Command|julia
{{Command|julia
Line 66: Line 55:
</noinclude>
</noinclude>
[[File:Bell Graph.png|thumb|alt=Résultats de 1000 simulations de l'état de Bell.]]
[[File:Bell Graph.png|thumb|alt=Résultats de 1000 simulations de l'état de Bell.]]
</div>

Latest revision as of 20:38, 24 October 2024

Other languages:

Snowflurry is an open-source quantum computing library developed in Julia by Anyon Systems that allows you to build, simulate, and run quantum circuits. A related library called SnowflurryPlots allows you to visualize the simulation results in a bar chart. Useful to explore quantum computing, its features are described in the documentation and the installation guide is available on the GitHub page. Like 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 of our clusters. The Julia programming language must be loaded before accessing Snowflurry.

Question.png
[name@server ~]$ module load julia

The Julia programming interface is then called and the Snowflurry quantum library is loaded (in about 5-10 minutes) with the commands

Question.png
[name@server ~]$ julia
julia> import Pkg
julia> Pkg.add(url="https://github.com/SnowflurrySDK/Snowflurry.jl", rev="main")
julia> Pkg.add(url="https://github.com/SnowflurrySDK/SnowflurryPlots.jl", rev="main")
julia> using Snowflurry

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

Use case: Bell states

Bell states are maximally entangled two-qubit states. They are simple examples of two quantum phenomena: superposition and entanglement. The Snowflurry library allows you to construct the first Bell state as follows:

Question.png
[name@server ~]$ julia
julia> using Snowflurry
julia> circuit=QuantumCircuit(qubit_count=2);
julia> push!(circuit,hadamard(1));
julia> push!(circuit,control_x(1,2));
julia> print(circuit)

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

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

 julia> state = simulate(circuit)
 julia> print(state)   
 4-element Ket{ComplexF64}:
 0.7071067811865475 + 0.0im
 0.0 + 0.0im
 0.0 + 0.0im
 0.7071067811865475 + 0.0im


The readout operation lets you specify which qubits will be measured. The plot_histogram function from the SnowflurryPlots library allows you to visualize the results.

Question.png
[name@server ~]$ julia
julia> using SnowflurryPlots
julia> push!(circuit, readout(1,1), readout(2,2))
julia> plot_histogram(circuit,1000)
Résultats de 1000 simulations de l'état de Bell.