Skip to content

Commit 7dd3899

Browse files
DmitryVasilevskyDmitry Vasilevsky
and
Dmitry Vasilevsky
authored
Reworked adders and tests (#878)
Added and reworked all adders and helper operations. Adders supported: * General in-place adder `IncByLE`. Implemented via TTK adder. Specific implementations: * `RippleCarryTTKIncByLE` * `RippleCarryCGIncByLE` * `FourierTDIncByLE` * General `IncByI`. Implemented via `IncByIUsingIncByLE(RippleCarryTTKIncByLE)`. * General `IncByL` implemented via `IncByLUsingIncByLE(RippleCarryTTKIncByLE)`. * General out-of-place adder `AddLE`. Implementated via CG adder. Specific implementations: * `RippleCarryCGAddLE` * `LookAheadDKRSAddLE` * Helper function `IncByLEUsingAddLE` to use two out-of-place adders to add in-place. * Helper function `IncByIUsingIncByLE` to increase by Int using an in-place adder. * Helper function `IncByLUsingIncByLE` to increase by BigInt using an in-place adder. TTK adder updated to reduce simulation time by ~7%, CG adder updated to reduce simulation time by ~30%. Added and unified tests. All adders are now in the Microsoft.Qunatum.**Unstable**.Arithmetic namespace to signify that they will change in future and will be moved to a separate library when we have support for it. Note that we will entirely remove Microsoft.Qunatum.Arithmetic namespace from the standard library by moving a few remaining operations to a different namespace where they fit better. This will be in a separate PR. --------- Co-authored-by: Dmitry Vasilevsky <[email protected]>
1 parent 5c45282 commit 7dd3899

13 files changed

+1319
-1242
lines changed

compiler/qsc_frontend/src/compile.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,6 @@ pub fn std(store: &PackageStore, target: TargetProfile) -> CompileUnit {
397397
"arithmetic.qs".into(),
398398
include_str!("../../../library/std/arithmetic.qs").into(),
399399
),
400-
(
401-
"arithmetic_internal.qs".into(),
402-
include_str!("../../../library/std/arithmetic_internal.qs").into(),
403-
),
404400
(
405401
"arrays.qs".into(),
406402
include_str!("../../../library/std/arrays.qs").into(),
@@ -445,6 +441,14 @@ pub fn std(store: &PackageStore, target: TargetProfile) -> CompileUnit {
445441
"random.qs".into(),
446442
include_str!("../../../library/std/random.qs").into(),
447443
),
444+
(
445+
"unstable_arithmetic.qs".into(),
446+
include_str!("../../../library/std/unstable_arithmetic.qs").into(),
447+
),
448+
(
449+
"unstable_arithmetic_internal.qs".into(),
450+
include_str!("../../../library/std/unstable_arithmetic_internal.qs").into(),
451+
),
448452
],
449453
None,
450454
);

0 commit comments

Comments
 (0)