Skip to content

Arithmetic test utils#3400

Merged
fedimser merged 20 commits into
mainfrom
fedimser/classical-arith
Jul 17, 2026
Merged

Arithmetic test utils#3400
fedimser merged 20 commits into
mainfrom
fedimser/classical-arith

Conversation

@fedimser

@fedimser fedimser commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
  • Q# test functions to test arithmetic operations:
    • ApplyBigInt - writes BigInt to register.
    • MeasureBigInt - reads BigInt from register and resets register to 0.
    • TestArithmeticOp - writes one or more inputs to registers, applies operation and reads output.
  • Python class test_utils.ArithmeticOpTester to run Q# arithmetic operation on given inputs. Supports input as string or as callable.
    • Wrapper around Std.ArithmeticTestUtils.TestArithmeticOp.
    • Optimized for testing the same operation on many inputs.
  • Std.ArithmeticTestUtils.ApplyClassicalFunction. This Q# function allows to specify classical arithmetic function (as Q# closure) and turn it into arithmetic gate that will apply that function to every basis state.
    • Implemented in sparse simulator only.
    • Also has Q#-only wrappers that provides controlled version, and versions acting on 2 and 3 arguments.
    • This addresses [Feature Request] ArithmeticGate #3272

Comment thread source/qdk_package/qdk/test_utils.py Dismissed
Comment thread source/qdk_package/qdk/test_utils.py Dismissed
Comment thread source/qdk_package/tests/test_test_utils.py Dismissed
Comment thread source/qdk_package/tests/test_test_utils.py Dismissed
@fedimser
fedimser marked this pull request as ready for review June 27, 2026 00:51
@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for 50cbe8e

Test This Branch On Main Difference
compile core + standard lib 26725891 bytes 24588971 bytes 2136920 bytes

Comment thread library/std/src/Std/ArithmeticTestUtils.qs Outdated
Comment thread library/std/src/Std/ArithmeticTestUtils.qs Outdated
Comment thread library/std/src/Std/ArithmeticTestUtils.qs Outdated
Comment thread library/std/src/Std/ArithmeticTestUtils.qs Outdated
Comment thread library/std/src/Std/ArithmeticTestUtils.qs Outdated
Comment thread library/std/src/Std/ArithmeticTestUtils.qs
@fedimser
fedimser requested a review from amcasey as a code owner July 15, 2026 00:28
@fedimser
fedimser requested a review from swernli July 15, 2026 00:28
@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for 6c9392f

Test This Branch On Main Difference
compile core + standard lib 26678235 bytes 24620839 bytes 2057396 bytes

@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for de14249

Test This Branch On Main Difference
compile core + standard lib 26678235 bytes 24620839 bytes 2057396 bytes

@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for 0aa3a1d

Test This Branch On Main Difference
compile core + standard lib 26678235 bytes 24620839 bytes 2057396 bytes

@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for 363bc9f

Test This Branch On Main Difference
compile core + standard lib 26678235 bytes 24620839 bytes 2057396 bytes

@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for f47b919

Test This Branch On Main Difference
compile core + standard lib 26678235 bytes 24620839 bytes 2057396 bytes

@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for 08b9054

Test This Branch On Main Difference
compile core + standard lib 26678235 bytes 24620839 bytes 2057396 bytes

@swernli swernli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor tweak to the library file (which will unfortunately churn some snapshots again, I believe), and one more test of the simulator implementation, and I think this is ready to go in!

Comment thread library/std/src/Std/Measurement.qs Outdated
Comment thread source/simulators/src/sparse_state_simulator/tests.rs
@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for a61c153

Test This Branch On Main Difference
compile core + standard lib 26677875 bytes 24620839 bytes 2057036 bytes

@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for 47d6b87

Test This Branch On Main Difference
compile core + standard lib 26677875 bytes 24620839 bytes 2057036 bytes

@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for c0046db

Test This Branch On Main Difference
compile core + standard lib 26677875 bytes 24620839 bytes 2057036 bytes

@fedimser
fedimser enabled auto-merge July 17, 2026 18:26
@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for 2eed519

Test This Branch On Main Difference
compile core + standard lib 26677875 bytes 24620839 bytes 2057036 bytes

@fedimser
fedimser added this pull request to the merge queue Jul 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Jul 17, 2026
@fedimser
fedimser enabled auto-merge July 17, 2026 19:17
@github-actions

Copy link
Copy Markdown

Change in memory usage detected by benchmark.

Memory Report for d9a968b

Test This Branch On Main Difference
compile core + standard lib 26677875 bytes 24620839 bytes 2057036 bytes

@fedimser
fedimser added this pull request to the merge queue Jul 17, 2026
Merged via the queue into main with commit d663879 Jul 17, 2026
13 checks passed
@fedimser
fedimser deleted the fedimser/classical-arith branch July 17, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants