commit ba4e87e8c4c5fc760dad4cc177319623f7c2b1e9 Author: Anton Romanov Date: Fri Aug 9 15:32:07 2024 +0400 Add first example diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..812ab5a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..456b54b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/showcase.iml b/.idea/showcase.iml new file mode 100644 index 0000000..27487ca --- /dev/null +++ b/.idea/showcase.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..d2bbdc0 --- /dev/null +++ b/main.py @@ -0,0 +1,25 @@ +from spinqit import get_basic_simulator, get_compiler, Circuit, BasicSimulatorConfig +from spinqit import H, CX, Rx +from math import pi + +# Write the program +circ = Circuit() +q = circ.allocateQubits(2) +circ << (Rx, q[0], pi) +circ << (H, q[1]) +circ << (CX, (q[0], q[1])) + +# Choose the compiler and backend +comp = get_compiler("native") +engine = get_basic_simulator() + +# Compile +optimization_level = 0 +exe = comp.compile(circ, optimization_level) + +# Run +config = BasicSimulatorConfig() +config.configure_shots(1024) +result = engine.execute(exe, config) + +print(result.counts) \ No newline at end of file