Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0482e51
Bug fixes and Feature additions
gurukasi-2006 Dec 6, 2025
f9111da
Support for Input() and split
gurukasi-2006 Dec 6, 2025
46435f2
added nodes for continue and break
gurukasi-2006 Dec 7, 2025
145a80d
fixed the bug that wants explicit type annotation inside classes for …
gurukasi-2006 Dec 7, 2025
c12a976
error handling system
gurukasi-2006 Dec 7, 2025
0c39855
Merge pull request #1 from Quantica-Foundation/main
gurukasi-2006 Dec 7, 2025
6074d16
Merge branch 'Quantica-Foundation:main' into main
gurukasi-2006 Dec 8, 2025
a1a1482
Added better Error handling v2 still needs bug fixes
gurukasi-2006 Dec 8, 2025
6c8c1e5
Add files via upload
gurukasi-2006 Dec 8, 2025
9f4f085
Add files via upload
gurukasi-2006 Dec 8, 2025
c71e029
added error_codes website
gurukasi-2006 Dec 8, 2025
97709ec
comments updtion
gurukasi-2006 Dec 9, 2025
d883409
comments updation
gurukasi-2006 Dec 9, 2025
8fe3d28
comments updation bug fixed
gurukasi-2006 Dec 9, 2025
8304983
Qubit Lifecycle Management system v1
gurukasi-2006 Dec 10, 2025
a4f0594
Add files via upload
gurukasi-2006 Dec 10, 2025
a4b0efd
Native backend as Default for All the quantum programs
gurukasi-2006 Dec 11, 2025
f3cfc03
Update mod.rs
gurukasi-2006 Dec 11, 2025
da45806
fixed lifecycle related bugs
gurukasi-2006 Dec 11, 2025
d098831
Add files via upload
gurukasi-2006 Dec 11, 2025
83b0c74
Fixed bugs to implement AI features
gurukasi-2006 Dec 12, 2025
11f45f0
Tensor Support (***) for Ai and ML applications
gurukasi-2006 Dec 13, 2025
47707d8
bug fixed related to tensor
gurukasi-2006 Dec 13, 2025
29891cb
Add files via upload
gurukasi-2006 Dec 13, 2025
f7bd6b5
Add files via upload
gurukasi-2006 Dec 13, 2025
28f37eb
added Stdlib upport for AI and ML and fixed bugs and also save load f…
gurukasi-2006 Dec 13, 2025
565d436
Fixed bugs related to AI implementation
gurukasi-2006 Dec 14, 2025
30b82f1
Optimized ai training speed upto 2x
gurukasi-2006 Dec 14, 2025
ea36350
added mnist examples
gurukasi-2006 Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "quantica"
version = "0.1.0"
version = "0.2.0"
edition = "2021"


# This new [lib] section tells Cargo to build libquantica.a
[lib]
name = "quantica"
path = "src/lib.rs"
crate-type = ["staticlib","rlib"]




# This tells Cargo to also build the quantica.exe compiler
[[bin]]
name = "quantica"
path = "src/main.rs"
Expand All @@ -21,16 +21,19 @@ num-complex = "0.4.6"
rand = "0.8.5"
inkwell = { version = "0.6.0", features = ["llvm18-1"] }
libc = "0.2"
actix-web = "4"
serde = { version = "1.0", features = ["derive"] } #JSON
actix-web = "4" # The web server framework
serde = { version = "1.0", features = ["derive"] } # For JSON
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
reqwest = { version = "0.11", features = ["json", "blocking"] }
serde_json = "1.0"
lazy_static = "1.4"
rayon = "1.7"
colored = "2.1"

[profile.dev]

debug = 0
strip = "symbols"
codegen-units = 1
overflow-checks = false
codegen-units = 1 # Force single compilation unit
overflow-checks = false # Can sometimes interfere with code size checks
lto = "fat"
16 changes: 16 additions & 0 deletions examples/bell_test.qc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Bell State Test for IBM Quantum Hardware
func main():
// Create a 2-qubit register
quantum q[2]

// Create Bell state: (|00⟩ + |11⟩)/√2
apply Hadamard(q[0])
apply CNOT(q[0], q[1])

// Measure both qubits
let m0 = measure(q[0])
let m1 = measure(q[1])

print("Measured qubit 0:", m0)
print("Measured qubit 1:", m1)
print("Bell state created successfully!")
177 changes: 177 additions & 0 deletions examples/classes_example.qc
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
// examples/classes_example.qc
// Demonstrating classes and objects in Quantica

print("=== QUANTICA CLASSES & OBJECTS ===\n")

// --- Example 1: Basic Class ---
print("--- Example 1: Basic Point Class ---")

class Point:
let x: Float = 0.0
let y: Float = 0.0

func init(x_val: Float, y_val: Float):
x = x_val
y = y_val

func distance_from_origin() -> Float:
return sqrt(x * x + y * y)

func move(dx: Float, dy: Float):
x = x + dx
y = y + dy

func display():
print("Point(" + to_string(x) + ", " + to_string(y) + ")")

let p1 = new Point(3.0, 4.0)
p1.display()
print("Distance from origin:", p1.distance_from_origin())

p1.move(1.0, 1.0)
print("After moving:")
p1.display()

// --- Example 2: Quantum Circuit Class ---
print("\n--- Example 2: Quantum Circuit Class ---")

class QuantumCircuit:
let num_qubits: Int
let qreg: QuantumRegister

func init(n: Int):
num_qubits = n
quantum temp[n]
qreg = temp

func apply_hadamard(index: Int):
apply Hadamard(qreg[index])

func apply_cnot(control: Int, target: Int):
apply CNOT(qreg[control], qreg[target])

func measure_all():
for i in 0..num_qubits:
let result = measure(qreg[i])
print("Qubit", i, ":", result)

func create_bell_state():
apply_hadamard(0)
apply_cnot(0, 1)

let circuit = new QuantumCircuit(2)
circuit.create_bell_state()
print("Bell state created!")
circuit.measure_all()

// --- Example 3: Inheritance (if supported) ---
print("\n--- Example 3: Vector Class with Inheritance ---")

class Vector2D:
public let x: Float
public let y: Float

func init(x_val: Float, y_val: Float):
x = x_val
y = y_val

func magnitude() -> Float:
return sqrt(x * x + y * y)

func dot(other: Vector2D) -> Float:
return x * other.x + y * other.y

class Vector3D(Vector2D):
public let z: Float

func init(x_val: Float, y_val: Float, z_val: Float):
super.init(x_val, y_val)
z = z_val

func magnitude() -> Float:
return sqrt(x * x + y * y + z * z)

func cross(other: Vector3D) -> Vector3D:
let cx = y * other.z - z * other.y
let cy = z * other.x - x * other.z
let cz = x * other.y - y * other.x
return new Vector3D(cx, cy, cz)

let v1 = new Vector3D(1.0, 0.0, 0.0)
let v2 = new Vector3D(0.0, 1.0, 0.0)
print("v1 magnitude:", v1.magnitude())
print("v1 dot v2:", v1.dot(v2))

// --- Example 4: Counter Class with Static Method ---
print("\n--- Example 4: Counter Class ---")

class Counter:
private mut count: Int = 0
static let max_count: Int = 100

func increment():
if count < max_count:
count = count + 1

func decrement():
if count > 0:
count = count - 1

func get_value() -> Int:
return count

func reset():
count = 0

let counter = new Counter()
counter.increment()
counter.increment()
counter.increment()
print("Counter value:", counter.get_value())

counter.decrement()
print("After decrement:", counter.get_value())

counter.reset()
print("After reset:", counter.get_value())

// --- Example 5: Quantum State Manager ---
print("\n--- Example 5: Quantum State Manager ---")

class QuantumStateManager:
private let states: Array
private mut current_index: Int

func init():
states = []
current_index = 0

func add_state(name: String, qreg: QuantumRegister):
// Store state information
states[current_index] = {"name": name, "register": qreg}
current_index = current_index + 1

func get_state_count() -> Int:
return current_index

func debug_all():
for i in 0..current_index:
let state = states[i]
print("State:", state["name"])
debug_state(state["register"])

let manager = new QuantumStateManager()

quantum q1[2]
apply Hadamard(q1[0])
manager.add_state("superposition", q1)

quantum q2[2]
apply X(q2[0])
apply CNOT(q2[0], q2[1])
manager.add_state("bell_state", q2)

print("\nStored states:", manager.get_state_count())
manager.debug_all()

print("\n=== CLASSES DEMONSTRATION COMPLETE ===")
Loading