-
Notifications
You must be signed in to change notification settings - Fork 855
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Classiq Bot
committed
Apr 15, 2024
1 parent
8a507fe
commit a66c416
Showing
341 changed files
with
6,369 additions
and
3,164 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"friendly_name": "Discrete Logarithm", | ||
"description": "Solving Discrete Logarithm Problem using Shor's Algorithm", | ||
"qmod_type": ["algorithms"], | ||
"level": ["advanced"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
qfunc discrete_log_oracle<g: int, x: int, N: int, order: int>(x1: qbit[], x2: qbit[], output func_res: qbit[]) { | ||
allocate<ceiling(log(N, 2))>(func_res); | ||
inplace_prepare_int<1>(func_res); | ||
modular_exp<N, x>(func_res, x1); | ||
modular_exp<N, g>(func_res, x2); | ||
} | ||
|
||
qfunc discrete_log<g: int, x: int, N: int, order: int>(output x1: qbit[], output x2: qbit[], output func_res: qbit[]) { | ||
allocate<ceiling(log(order, 2))>(x1); | ||
allocate<ceiling(log(order, 2))>(x2); | ||
hadamard_transform(x1); | ||
hadamard_transform(x2); | ||
discrete_log_oracle<g, x, N, order>(x1, x2, func_res); | ||
invert { | ||
qft(x1); | ||
} | ||
invert { | ||
qft(x2); | ||
} | ||
} | ||
|
||
qfunc main(output x1: qnum, output x2: qnum, output func_res: qnum) { | ||
discrete_log<3, 2, 5, 4>(x1, x2, func_res); | ||
} |
5 changes: 5 additions & 0 deletions
5
algorithms/algebraic/discrete_log/discrete_log.synthesis_options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"constraints": { | ||
"max_width": 13 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
algorithms/algebraic/shor/doubly_controlled_modular_adder.qmod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.