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

Refactor/integration #17

Merged
merged 10 commits into from
Mar 9, 2020
Merged

Refactor/integration #17

merged 10 commits into from
Mar 9, 2020

Conversation

thangleiter
Copy link
Member

@thangleiter thangleiter commented Mar 5, 2020

Integration over some form of the filter function and the spectrum happens in infidelity() and calculate_error_vector_correlation_functions(). There is quite a bit of duplicate code in those functions.

Additionally, for large dimensions the integrand can consume a lot of memory if set up in one go, eg

integrand = np.einsum('jko,jo,jlo->jklo', R.conj(), S, R)

has n_nops * d**4 * n_omega elements. Switching instead to a loop over one of the factors of R in the integrand can significantly reduce the memory footprint to the order of the control matrix itself.

The downside to this is of course a loss in performance since we replace einsum by a Python loop. Therefore introduce a switch to let the user control this.

Make separate function that can be called with the keywords
``show_progressbar`` and ``prefix``. If the first is True, a progressbar
is shown during the loop, if not, not.
If True, the integrand in calculate_error_vector_correlation_functions()
is iteratively computed instead of all at once. This lowers the required
memory by a factor of d**2 at the cost of being slower (Python loop
instead of einsum)
@coveralls
Copy link

coveralls commented Mar 5, 2020

Pull Request Test Coverage Report for Build 112

  • 112 of 112 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.6%) to 94.028%

Totals Coverage Status
Change from base Build 106: 0.6%
Covered Lines: 1717
Relevant Lines: 1798

💛 - Coveralls

@thangleiter thangleiter merged commit c7995b5 into master Mar 9, 2020
@thangleiter thangleiter deleted the refactor/integration branch March 9, 2020 13:09
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.

None yet

2 participants