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

Fix/complex output ordering #612

Merged
merged 3 commits into from
Aug 25, 2022
Merged

Fix/complex output ordering #612

merged 3 commits into from
Aug 25, 2022

Conversation

WardBrian
Copy link
Member

Submission Checklist

  • Run unit tests
  • Declare copyright holder and open-source license: see below

Summary

First reported by @tillahoffmann on the forums here, CmdStanPy was mangling complex-valued outputs.

The original PR #537 did not include a test asserting that the actual values were recovered in the correct order, which this also fixes. The current code that complex numbers in the output are stored like an extra final dimension of size 2 (this is, after all, how they are treated in the program inputs). But they’re not really, they’re stored strided alongside the other dimensions.

To make this concrete, a vector of 3 elements was being read in as if it was stored as x.1.real, x.2.real, x.3.real, x.1.imag. x.2.imag, x.3.imag, but really it is actually written to disk as x.1.real, x.1.imag, x.2.real, x.2.imag, ...

I think once this is merged we should release a patch version (1.0.7) almost immediately.

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):

Simons Foundation

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

@WardBrian WardBrian added the bug Something isn't working label Aug 24, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2022

Codecov Report

Merging #612 (94528b7) into develop (d71e3fa) will increase coverage by 0.06%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop     #612      +/-   ##
===========================================
+ Coverage    80.35%   80.42%   +0.06%     
===========================================
  Files           69       69              
  Lines        10224    10257      +33     
===========================================
+ Hits          8216     8249      +33     
  Misses        2008     2008              
Impacted Files Coverage Δ
cmdstanpy/cmdstanpy/utils/data_munging.py 100.00% <0.00%> (ø)
...mdstanpy/cmdstanpy/cmdstanpy/utils/data_munging.py 100.00% <0.00%> (ø)
...mdstanpy/cmdstanpy/cmdstanpy/utils/data_munging.py 100.00% <0.00%> (ø)
cmdstanpy/cmdstanpy/stanfit/mcmc.py 96.65% <0.00%> (+0.02%) ⬆️
a/cmdstanpy/cmdstanpy/cmdstanpy/stanfit/mcmc.py 96.65% <0.00%> (+0.02%) ⬆️
...work/cmdstanpy/cmdstanpy/cmdstanpy/stanfit/mcmc.py 96.65% <0.00%> (+0.02%) ⬆️
cmdstanpy/cmdstanpy/stanfit/gq.py 88.26% <0.00%> (+0.12%) ⬆️
a/cmdstanpy/cmdstanpy/cmdstanpy/stanfit/gq.py 88.26% <0.00%> (+0.12%) ⬆️
...r/work/cmdstanpy/cmdstanpy/cmdstanpy/stanfit/gq.py 88.26% <0.00%> (+0.12%) ⬆️
cmdstanpy/cmdstanpy/stanfit/vb.py 94.93% <0.00%> (+0.13%) ⬆️
... and 5 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@mitzimorris mitzimorris left a comment

Choose a reason for hiding this comment

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

great! thanks for fixing!

@WardBrian WardBrian merged commit 997a60b into develop Aug 25, 2022
@WardBrian WardBrian deleted the fix/complex-output-ordering branch August 25, 2022 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants