Skip to content

Add support for memory references in substitute() method#1384

Closed
mhodson-rigetti wants to merge 2 commits intorcfrom
1383-substitute-memory-references
Closed

Add support for memory references in substitute() method#1384
mhodson-rigetti wants to merge 2 commits intorcfrom
1383-substitute-memory-references

Conversation

@mhodson-rigetti
Copy link
Contributor

@mhodson-rigetti mhodson-rigetti commented Sep 22, 2021

Description

Addresses #1383 generally as suggested. However, because the identity of a memory reference (as a key- ie. its hash) includes the offset, and substitution is via a map using this key, it was easier to ask the user to address each offset to be substituted individually. Thus, conceptually, the substitution map is { x[0]: <number>, x[1]: <number>, x[2]: <number> } for some array x of length 3.

I'm assuming there are no large-scale performance expectations on this new ability where the array access would make a difference. There is no impact on previous code paths. The alternative would be to use the names (strings) only as the key, but that would technically be a breaking change, where as this PR is not (the key is covariant to the previous Parameter class, and now also MemoryReference).

Checklist

  • The PR targets the rc branch (not master).
  • Commit messages are prefixed with one of the prefixes outlined in the commit syntax checker (see pattern field).
  • The above description motivates these changes.
  • There is a unit test that covers these changes.
  • All new and existing tests pass locally and on the PR's checks.
  • Parameters and return values have type hints with PEP 484 syntax.
  • Functions and classes have useful Sphinx-style docstrings.
  • All code follows Black style and obeys flake8 conventions.
  • (New Feature) The docs have been updated accordingly.
  • (Bugfix) The associated issue is referenced above using auto-close keywords.
  • The changelog is updated, including author and PR number (@username, Test ignore #1234).

…ays for the values, and require the user to individually address the values for each memory offset.
@mhodson-rigetti mhodson-rigetti requested a review from a team as a code owner September 22, 2021 12:21
@mhodson-rigetti mhodson-rigetti changed the base branch from master to rc September 22, 2021 12:22
@mhodson-rigetti mhodson-rigetti deleted the 1383-substitute-memory-references branch September 22, 2021 12: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.

1 participant