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

Add unit test for validating trotterization order #1120

Merged
merged 4 commits into from
Dec 18, 2019
Merged

Add unit test for validating trotterization order #1120

merged 4 commits into from
Dec 18, 2019

Conversation

jmbr
Copy link
Contributor

@jmbr jmbr commented Dec 5, 2019

Add unit test validating the order of the trotterization schemes.

@jmbr jmbr requested a review from a team as a code owner December 5, 2019 03:41
@appleby
Copy link
Contributor

appleby commented Dec 9, 2019

Semaphore is complaining about scipy. Probably needs to be added to requirements.txt.

Is there any sane way to avoid the scipy dependency? Scipy is useful enough that I don't feel that bad about adding it to dependencies (I'm a little surprised we didn't already depend on it), but if there is a not-too-onerous way to avoid pulling it in just for this test, that might be preferable.

@jmbr
Copy link
Contributor Author

jmbr commented Dec 9, 2019

Semaphore is complaining about scipy. Probably needs to be added to requirements.txt.

Is there any sane way to avoid the scipy dependency? Scipy is useful enough that I don't feel that bad about adding it to dependencies (I'm a little surprised we didn't already depend on it), but if there is a not-too-onerous way to avoid pulling it in just for this test, that might be preferable.

Thanks for pointing the dependency out. I took it for granted that it was one of the prerequisites. I think I can work around it, though.

Copy link
Contributor

@appleby appleby left a comment

Choose a reason for hiding this comment

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

I had to google "matrix exponential" so I'm probably not the best person to review the math here, but otherwise lgtm.

xs = 10**np.logspace(-1, -6, 10)
for order in [1, 2, 3, 4]:
ys = [error(order, float(x)) for x in xs]
p = np.polyfit(np.log10(xs), np.log10(ys), 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

@karalekas karalekas added the enhancement ✨ A request for a new feature. label Dec 18, 2019
@karalekas karalekas changed the title Test trotterization order. Add unit test for validating trotterization order Dec 18, 2019
Copy link
Contributor

@karalekas karalekas left a comment

Choose a reason for hiding this comment

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

All this needs is a CHANGELOG entry and it's ready to merge.

@karalekas karalekas added this to the v2.15 milestone Dec 18, 2019
@karalekas karalekas merged commit d5bc3eb into rigetti:master Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ A request for a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants