Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Costs] Success probability #970

Merged

Conversation

mpharrigan
Copy link
Collaborator

Add a new CostKey for multiplying success probabilities. Part of #899

logger = logging.getLogger(__name__)


@frozen
Copy link
Collaborator

@fdmalone fdmalone May 20, 2024

Choose a reason for hiding this comment

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

Out of scope for this PR but it would be nice to have some notebook expanding on this as a concept (success probability)

logger.info("Computing %s for %s from %d callee(s)", self, bloq, len(callees))
for callee, n in callees:
v = get_callee_cost(callee)
tot *= v**n
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would we eventually need to deal with like the log of the success probability so things are additive. This looks like it runs the risk of potentially hitting numerical issues.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I realized later that after writing this that if the success probability was so small to warrant something special it would be a dreadful quantum algorithm.

Copy link
Collaborator

@fdmalone fdmalone left a comment

Choose a reason for hiding this comment

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

LGTM. I think multiplying lots of numbers together is potentially risky, but maybe it's not really a concern.

_why_is_everything_so_private_lately?

Comment on lines +36 to +42
def compute(self, bloq: 'Bloq', get_callee_cost: Callable[['Bloq'], float]) -> float:
tot: float = 1.0
callees = get_bloq_callee_counts(bloq)
logger.info("Computing %s for %s from %d callee(s)", self, bloq, len(callees))
for callee, n in callees:
v = get_callee_cost(callee)
tot *= v**n
Copy link
Collaborator

Choose a reason for hiding this comment

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

The way this is written, would we ever need this as a separate cost? Can we just use g, sigma = bloq.build_call_graph(pred=pred) and then accumulate the error probability using bloq, counts in sigma ?

Is there a good example that motivates this cost key that already exists in another branch / is easy to describe ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you need the contributions from inner nodes as well, not just the leafs that will show up in sigma.

This was requested by someone at the IEEE meeting last year and is a good demo of a different type of cost

@mpharrigan mpharrigan enabled auto-merge (squash) May 29, 2024 17:16
@mpharrigan mpharrigan merged commit c2e85c6 into quantumlib:main May 29, 2024
7 checks passed
@mpharrigan mpharrigan mentioned this pull request Aug 22, 2024
6 tasks
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