Skip to content

Add impls of Program node for various math operations#16107

Draft
ihincks wants to merge 10 commits intoQiskit:mainfrom
ihincks:program-node-math
Draft

Add impls of Program node for various math operations#16107
ihincks wants to merge 10 commits intoQiskit:mainfrom
ihincks:program-node-math

Conversation

@ihincks
Copy link
Copy Markdown
Contributor

@ihincks ihincks commented Apr 29, 2026

This PR closes #16031 by implementing ProgramNode for various math-y structs.

  • Add
  • Subtract
  • Multiply
  • Divide
  • Remainder
  • Power

PR Stack

AI/LLM disclosure

  • I didn't use LLM tooling, or only used it privately.
  • I used the following tool to help write this PR description:
  • I used the following tool to generate or modify code: Claude 4.6

mtreinish and others added 6 commits April 28, 2026 13:34
This commit adds a new data structure to the new providers crate
DataTree. The DataTree is a generic tree structure that will be used to
define the operation ports in the QuantumProgram's tensor compute
graph's nodes. Right now this is just one of the building blocks towards
defining the QuantumProgram. As it isn't being used right now since the
rest of the components don't exist yet, this is solely self tested. When
subsequent components are added tests using the DataTree as part of
Operation types and eventually in a QuantumProgram will be needed as
well.
This commit adds a new type PathEntry that is used to outline a path
through the DataTree into a leaf node. Along with this are two new
methods to lookup a leaf node by a path and also to traverse the tree to
get leaf nodes along with the path to that node.
This commit changes the type hierarchy for DataTree to move the struct
from being a vec of enums of either leaves or branches. To each DataTree
being an enum of either a leaf or branch and each branch contains a vec
of DataTrees. This is a more natural form as the outer type can either
be a leaf or branch and simplifies working with the tree.
@ihincks ihincks requested a review from a team as a code owner April 29, 2026 20:04
@ihincks ihincks added Rust This PR or issue is related to Rust code in the repository mod: providers Related to the backend and job abstractions labels Apr 29, 2026
@qiskit-bot
Copy link
Copy Markdown
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@ihincks ihincks marked this pull request as draft April 29, 2026 20:04
@ihincks ihincks mentioned this pull request Apr 29, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 29, 2026

Coverage Report for CI Build 25187855166

Coverage decreased (-0.2%) to 87.378%

Details

  • Coverage decreased (-0.2%) from the base build.
  • Patch coverage: 454 uncovered changes across 6 files (1089 of 1543 lines covered, 70.58%).
  • 7 coverage regressions across 2 files.

Uncovered Changes

File Changed Covered %
crates/providers/src/tensor.rs 340 212 62.35%
crates/providers/src/math_nodes/reduction.rs 282 180 63.83%
crates/providers/src/math_nodes/bitwise.rs 179 91 50.84%
crates/providers/src/data_tree.rs 464 397 85.56%
crates/providers/src/math_nodes/binary.rs 188 129 68.62%
crates/providers/src/store.rs 87 77 88.51%

Coverage Regressions

7 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
crates/qasm2/src/parse.rs 6 97.63%
crates/qasm2/src/lex.rs 1 92.8%

Coverage Stats

Coverage Status
Relevant Lines: 122892
Covered Lines: 107381
Line Coverage: 87.38%
Coverage Strength: 953298.32 hits per line

💛 - Coveralls

@ShellyGarion ShellyGarion added this to the 2.5.0 milestone Apr 30, 2026
@ihincks ihincks force-pushed the program-node-math branch from c8bea7a to b429b8d Compare April 30, 2026 20:22
@ihincks ihincks force-pushed the program-node-math branch from b429b8d to a437668 Compare April 30, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod: providers Related to the backend and job abstractions Rust This PR or issue is related to Rust code in the repository

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

Implement built-in math ProgramNodes

5 participants