qff-hackathon-uet 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
qff_grader/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ """QFF Grader."""
2
+ __version__ = "1.0.0"
@@ -0,0 +1,63 @@
1
+ import hashlib
2
+ import numpy as np
3
+ from qiskit.quantum_info import Statevector, partial_trace, state_fidelity
4
+ from qiskit.transpiler import CouplingMap
5
+ from qiskit import transpile
6
+
7
+ NUM_QUBITS = 20
8
+ TARGET_QUBITS = [0, 4, 7, 10, 14, 15, 19]
9
+
10
+ def _build_coupling_map() -> CouplingMap:
11
+ edges = [
12
+ (0, 1), (1, 2), (2, 3), (3, 4), (5, 6), (6, 7), (7, 8), (8, 9),
13
+ (10, 11), (11, 12), (12, 13), (13, 14), (15, 16), (16, 17), (17, 18), (18, 19),
14
+ (1, 6), (3, 8), (5, 10), (6, 11), (7, 12), (8, 13), (9, 14), (11, 16), (13, 18),
15
+ (6, 10), (8, 14), (12, 16), (12, 18),
16
+ ]
17
+ edges += [(b, a) for a, b in edges]
18
+ return CouplingMap(edges)
19
+
20
+ def grade_hackathon_ghz(qc):
21
+ print("Grading your answer. Please wait...\n")
22
+ if qc.num_qubits != NUM_QUBITS:
23
+ print(f"❌ Expected {NUM_QUBITS} qubits, got {qc.num_qubits}.")
24
+ return
25
+
26
+ edges = _build_coupling_map().get_edges()
27
+ for inst in qc.data:
28
+ if len(inst.qubits) != 2 or inst.name == "if_else": continue
29
+ edge = tuple(q._index for q in inst.qubits)
30
+ if edge not in edges:
31
+ print(f"❌ {inst.name.upper()}{edge} not on coupling map.")
32
+ return
33
+
34
+ try:
35
+ sv = Statevector(qc)
36
+ except Exception as e:
37
+ print(f"❌ Could not simulate: {e}")
38
+ return
39
+
40
+ ghz = np.zeros(2 ** len(TARGET_QUBITS), dtype=complex)
41
+ ghz[0] = ghz[-1] = 1 / np.sqrt(2)
42
+ others = [q for q in range(qc.num_qubits) if q not in TARGET_QUBITS]
43
+
44
+ target_sv = partial_trace(sv, others)
45
+ fidelity = float(state_fidelity(target_sv, ghz))
46
+
47
+ if fidelity < 0.999:
48
+ print(f"❌ Circuit not valid. Fidelity: {fidelity:.6f}")
49
+ return
50
+
51
+ tqc = transpile(qc, coupling_map=_build_coupling_map(), basis_gates=["h", "x", "sx", "rz", "cx"], initial_layout=list(range(qc.num_qubits)), optimization_level=0)
52
+ depth = tqc.depth()
53
+ cx = tqc.count_ops().get("cx", 0)
54
+ score = depth + cx
55
+
56
+ code = hashlib.sha256(f"ghz::{depth}::{cx}::qff2026".encode()).hexdigest().upper()[:8]
57
+
58
+ print("🎉 Circuit is valid!")
59
+ print(f" Fidelity: {fidelity:.6f}")
60
+ print(f" Depth: {depth}")
61
+ print(f" CX count: {cx}")
62
+ print(f" Score: {score} (lower is better)\n")
63
+ print(f" Submission code: {code}")
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: qff-hackathon-uet
3
+ Version: 1.0.0
4
+ Summary: Grader for Qiskit Fall Fest 2026
5
+ Author: Noor Ul Ain
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: qiskit>=2.0
9
+ Requires-Dist: networkx
10
+ Requires-Dist: numpy
11
+
12
+ # QFF Hackathon UET Grader
@@ -0,0 +1,6 @@
1
+ qff_grader/__init__.py,sha256=FRE9m-dvdYdUcqH_aYXovdMX7-qBFA3btINzecJecDE,40
2
+ qff_grader/lab_hackathon.py,sha256=B3H2kj627HQQj-g11HvaPEDNv3lpWIODXMFxamMPiiI,2299
3
+ qff_hackathon_uet-1.0.0.dist-info/METADATA,sha256=8RuAX6gYAJQJ8nFG0Jk3jf66tOzpf5KP_s6NzvrKyDk,287
4
+ qff_hackathon_uet-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ qff_hackathon_uet-1.0.0.dist-info/top_level.txt,sha256=NXeoICygO6iajD1YVO4jcgoKtBTws79IYBMql04GCV8,11
6
+ qff_hackathon_uet-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ qff_grader