Create ModNeg and CModNeg#1300
Create ModNeg and CModNeg#1300NoureldinYosri merged 16 commits intoquantumlib:mainfrom NoureldinYosri:mod_subtraction
Conversation
| p = 13 | ||
| b = MontgomeryModNeg(n, p) | ||
| target_cost = QECGatesCost() | ||
| cost: GateCounts = query_costs(b, [target_cost])[b][target_cost] |
| counts = get_cost_value(b, QECGatesCost()).total_t_and_ccz_count() | ||
|
|
||
| assert counts['n_t'] == 0, 'all toffoli' | ||
| assert counts['n_ccz'] == 3 * (n - 1) + 1 |
There was a problem hiding this comment.
add a note/comment with litinski fig/table 8
There was a problem hiding this comment.
I didn't notice this at first but I'm not using the controlled decomposition from litinski ... this is my own decomposition which matches the cost but for the wrong reason... they turn the CNOTs into toffolis which is not necessary. I just combine the old control qubit and outer control qubit into an ancilla qubit that controls addition ... the CNOTs are left as is

for the uncontrolled version we have
There was a problem hiding this comment.
this is my own decomposition
This is important to capture somewhere in the docs
mpharrigan
left a comment
There was a problem hiding this comment.
some final things, then lgtm
|
|
||
| References: | ||
| [How to compute a 256-bit elliptic curve private key with only 50 million Toffoli gates](https://arxiv.org/abs/2306.08585) | ||
| Fig 6b and 8 |
There was a problem hiding this comment.
if this doesn't match the reference, please provide a short description of how/why in the class docstring
|
@mpharrigan I added the comments ... please take a look |
PS: ModSub and CModSub are ready but they depend on #1295