Skip to content

Arithmetic test utils#3400

Open
fedimser wants to merge 4 commits into
mainfrom
fedimser/classical-arith
Open

Arithmetic test utils#3400
fedimser wants to merge 4 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

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.

2 participants