Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f03f3b5
Added the time-marching differential equations solver example
orsa-classiq Dec 25, 2024
e73e6ce
added missing timeouts
orsa-classiq Dec 25, 2024
67063af
time marching latex fix
orsa-classiq Dec 26, 2024
c17fc0f
Rename notebook: hamiltonian simulation guide
classiqdor Dec 12, 2024
d7ea12e
Rename notebook: hamiltonian evolution
classiqdor Dec 12, 2024
062ffa2
Rename notebook: exponentiation example
classiqdor Dec 12, 2024
b8e9c36
Rename notebook: hhl example
classiqdor Dec 12, 2024
02242c4
Rename notebook: application option pricing
classiqdor Dec 12, 2024
ef9dfb5
Rename notebook: example prepare state
classiqdor Dec 12, 2024
8bc03f1
Fix rename
classiqdor Dec 12, 2024
55410da
Add test for unique notebook names
classiqdor Dec 12, 2024
fc27c4b
Update timeouts to be relative paths
classiqdor Dec 12, 2024
e35dd91
Update test to test for relative paths
classiqdor Dec 12, 2024
ad8c7f9
Fix
classiqdor Dec 12, 2024
3c475c2
Update error message
classiqdor Dec 12, 2024
f0f0de9
Allow functions qmods to have duplicates
classiqdor Dec 12, 2024
c2f731d
changed dqi notebook name
orsa-classiq Dec 15, 2024
c40908b
refactored set_partition, max_clique, ilp, ising
orsa-classiq Dec 8, 2024
2d58dbd
removed knapsack binary notebook
orsa-classiq Dec 8, 2024
9f8c7e7
with max_k_vertex_cover
orsa-classiq Dec 8, 2024
abf0393
updated notebooks accord\ing to CR comments and new CombiProblem inte…
orsa-classiq Dec 16, 2024
873f51c
updated timeouts
orsa-classiq Dec 16, 2024
79fa6ab
with portfolio optimization as well
orsa-classiq Dec 16, 2024
aef6c5c
fixed failing notebooks
orsa-classiq Dec 16, 2024
d048f90
Fix imports
ori-opher Dec 16, 2024
8d4c363
Update qmods
OriRothClassiq Dec 17, 2024
5f9f492
Update qmods
OriRothClassiq Dec 17, 2024
1a13e18
Update dqi Qmod
OriRothClassiq Dec 18, 2024
f295c69
adjusted integer using notebooks
orsa-classiq Dec 18, 2024
5af6e2e
test commit
orsa-classiq Dec 19, 2024
ce5a6c0
Fix file rename
classiqdor Dec 19, 2024
e61651c
adding SKEAPED_URLS list
Dec 19, 2024
7b9cb17
delete outdated note (also required to match the suggested solution)
Dec 17, 2024
9f9398f
delete unnecesarry note
Dec 17, 2024
6cd1a23
delete outdated hint
Dec 17, 2024
e71044d
fix probabilities to sum up to 1
Dec 17, 2024
d4471a8
Made suggestions for the English
AnnePicus Dec 19, 2024
2b17d53
updating notebook and tests requirements
Dec 22, 2024
18d7e26
fixed control with variable in both arguments issue
orsa-classiq Dec 24, 2024
b296658
English suggestions to Introducing Quantum Functions with Quantum Mon…
AnnePicus Dec 24, 2024
fc4d953
Merge branch 'dev' into merge_dev_main
orsa-classiq Dec 29, 2024
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
1,066 changes: 1,066 additions & 0 deletions algorithms/differential_equations/time_marching/time_marching.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"friendly_name": "Time Marching Based Quantum Solver",
"description": "Solving time-dependent linear equations using a Time-Marching based strategy and QSVT",
"problem_domain_tags": ["linear equation"],
"qmod_type": ["algorithms"],
"level": ["advanced"]
}
106 changes: 106 additions & 0 deletions algorithms/differential_equations/time_marching/time_marching.qmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
qstruct TimeDependentBE {
index: qnum<2>;
time: qnum<2>;
block: qbit;
}

qstruct MagnusBE {
time_dependent: TimeDependentBE;
qsvt_exp_aux: qbit;
qsvt_exp_lcu: qbit;
}

qstruct LongSliceBE {
magnus: MagnusBE;
qsvt_amplification_aux: qbit;
}

qstruct FullBE {
time_slice: LongSliceBE;
counter: qnum<3.0>;
}

qfunc magnus_projector(qbe: MagnusBE, is_in_block: qbit) {
is_in_block ^= ((qbe.time_dependent.block == 0) and (qbe.time_dependent.time == 0)) and ((qbe.qsvt_exp_aux == 0) and (qbe.qsvt_exp_lcu == 0));
}

qfunc time_dependent_projector(qbe: TimeDependentBE, is_in_block: qbit) {
is_in_block ^= (qbe.block == 0) and (qbe.time == 0);
}

qfunc block_encode_time_dependent_A(a: real, b: real, qbe: TimeDependentBE) {
linear_pauli_rotations([Pauli::Y], [
(((b - a) * 2) / (2 ** qbe.time.size))
], [(2 * a)], qbe.time, qbe.block);
linear_pauli_rotations([Pauli::Y], [2], [0], qbe.index, qbe.block);
}

qfunc short_time_summation(a: real, b: real, qbe: TimeDependentBE) {
within {
hadamard_transform(qbe.time);
} apply {
block_encode_time_dependent_A(a, b, qbe);
}
}

qfunc short_time_magnus(a: real, b: real, qbe_st: MagnusBE) {
within {
H(qbe_st.qsvt_exp_lcu);
} apply {
qsvt_lcu([
4.7085,
3.0195,
0.0547,
4.7904,
0.0547,
3.0195,
(-17.2827)
], [
4.5651,
0.2495,
6.6887,
(-0.1862),
6.097,
0.4056,
0.2495,
(-20.5676)
], time_dependent_projector, time_dependent_projector, lambda(x) {
short_time_summation(a, b, x);
}, qbe_st.time_dependent, qbe_st.qsvt_exp_aux, qbe_st.qsvt_exp_lcu);
}
}

qfunc long_slice_evolution(a: real, b: real, qbe: LongSliceBE) {
qsvt([
4.1801,
2.3715,
4.6112,
4.5273,
(-1.7559),
4.6112,
8.6546,
(-20.9526)
], magnus_projector, magnus_projector, lambda(x) {
short_time_magnus(a, b, x);
}, qbe.magnus, qbe.qsvt_amplification_aux);
}

qfunc long_time_integrator_step(a: real, b: real, qbe_full: FullBE) {
long_slice_evolution(a, b, qbe_full.time_slice);
control ((((qbe_full.time_slice.magnus.time_dependent.block == 0) and (qbe_full.time_slice.magnus.time_dependent.time == 0)) and ((qbe_full.time_slice.magnus.qsvt_exp_aux == 0) and (qbe_full.time_slice.magnus.qsvt_exp_lcu == 0))) and (qbe_full.time_slice.qsvt_amplification_aux == 0)) {
qbe_full.counter += -1;
}
}

qfunc long_time_integrator(T: real, num_slices: int, qbe_full: FullBE) {
inplace_prepare_int(num_slices, qbe_full.counter);
repeat (i: num_slices) {
long_time_integrator_step((i * T) / num_slices, ((i + 1) * T) / num_slices, qbe_full);
}
}

qfunc main(output qbe: FullBE) {
allocate(qbe.size, qbe);
hadamard_transform(qbe.time_slice.magnus.time_dependent.index);
long_time_integrator(2, 4, qbe);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"constraints": {
"max_gate_count": {},
"optimization_parameter": "no_opt"
},
"preferences": {
"machine_precision": 8,
"custom_hardware_settings": {
"basis_gates": [
"cx",
"u2",
"y",
"ry",
"t",
"rx",
"cy",
"r",
"sxdg",
"cz",
"tdg",
"x",
"sdg",
"u1",
"u",
"h",
"sx",
"z",
"p",
"id",
"s",
"rz"
],
"is_symmetric_connectivity": true
},
"debug_mode": true,
"synthesize_all_separately": false,
"optimization_level": 0,
"output_format": ["qasm"],
"pretty_qasm": true,
"transpilation_option": "auto optimize",
"timeout_seconds": 300,
"random_seed": 590453799
}
}
2 changes: 2 additions & 0 deletions requirements_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ testbook
torch
torchvision
galois
cvxpy
pyqsp==0.1.6
18 changes: 10 additions & 8 deletions tests/resources/timeouts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,13 @@ whitebox_fuzzing.qmod: 720
X.qmod: 10
Yasir_Mansour_HW3_VQE.ipynb: 30
Yasir_Mansour_HW4_molecule_eigensolver.ipynb: 600
classiq_discrete_quantum_walk.ipynb: 100
qiskit_discrete_quantum_walk.ipynb: 100
tket_discrete_quantum_walk.ipynb: 100
classiq_qsvt.ipynb: 100
pennylane_cat_qsvt_example.ipynb: 100
qiskit_qsvt.ipynb: 100
pennylane_catalyst_discrete_quantum_walk.ipynb: 100
tket_qsvt_example.ipynb: 100
classiq_discrete_quantum_walk.ipynb: 300
qiskit_discrete_quantum_walk.ipynb: 300
tket_discrete_quantum_walk.ipynb: 300
pennylane_catalyst_discrete_quantum_walk.ipynb: 300
tket_qsvt_example.ipynb: 300
classiq_qsvt.ipynb: 300
pennylane_cat_qsvt_example.ipynb: 300
qiskit_qsvt.ipynb: 300
time_marching.ipynb: 500
time_marching.qmod: 400
Loading