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

matrix_props: Check if stochastic or doubly stochastic #723

Merged
merged 13 commits into from
Aug 7, 2024

Conversation

purva-thakre
Copy link
Collaborator

@purva-thakre purva-thakre commented Aug 2, 2024

Description

Fixes #559
Fixes #560

Changes

Notable changes that this PR has either accomplished or will accomplish. Feel free to add more lines to the itemized list
below.

  • Instead of adding an is_stochastic function, this PR adds an is_right_stochastic and an is_left_stochastic function as the Wikipedia definitions make sure to distinguish the two. For 1 def, the rows should sum up to 1 while in the other, the columns should sum up to 1.
  • Also adds an is_doubly_stochastic function for the cases when a matrix is both right and left stochastic.

Checklist

Before marking your PR ready for review, make sure you checked the following locally. If this is your first PR, you might be notified of some workflow failures after a maintainer has approved the workflow jobs to be run on your PR.

Additional information is available in the documentation.

  • Use ruff for errors related to code style and formatting.
  • Verify all previous and newly added unit tests pass in pytest.
  • Check the documentation build does not lead to any failures. Sphinx build can be checked locally for any failures related to your PR
  • Use linkcheck to check for broken links in the documentation
  • Use doctest to verify the examples in the function docstrings work as expected.

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.7%. Comparing base (de9a087) to head (2eb2fd7).
Report is 18 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #723   +/-   ##
======================================
  Coverage    97.7%   97.7%           
======================================
  Files         166     167    +1     
  Lines        3250    3252    +2     
  Branches      795     795           
======================================
+ Hits         3177    3179    +2     
  Misses         48      48           
  Partials       25      25           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@purva-thakre purva-thakre marked this pull request as ready for review August 2, 2024 04:58
@purva-thakre
Copy link
Collaborator Author

@vprusso I am confused as to why the coverage report shows a line uncovered by unit tests in all 3 functions.

image

docs/refs.bib Outdated Show resolved Hide resolved
docs/refs.bib Outdated Show resolved Hide resolved
toqito/matrix_props/is_doubly_stochastic.py Outdated Show resolved Hide resolved
toqito/matrix_props/is_doubly_stochastic.py Outdated Show resolved Hide resolved
toqito/matrix_props/is_doubly_stochastic.py Outdated Show resolved Hide resolved
toqito/matrix_props/is_left_stochastic.py Outdated Show resolved Hide resolved
toqito/matrix_props/is_left_stochastic.py Outdated Show resolved Hide resolved
toqito/matrix_props/is_left_stochastic.py Outdated Show resolved Hide resolved
toqito/matrix_props/is_left_stochastic.py Outdated Show resolved Hide resolved
toqito/matrix_props/is_right_stochastic.py Outdated Show resolved Hide resolved
@purva-thakre purva-thakre force-pushed the matrix_props_stochastic branch 2 times, most recently from e80c329 to 6c3e039 Compare August 3, 2024 12:29
@vprusso
Copy link
Owner

vprusso commented Aug 4, 2024

Looks like there are still some uncovered cases from the coverage report here:
https://github.com/vprusso/toqito/pull/723/checks?check_run_id=28300233677

toqito/matrix_props/is_stochastic.py Outdated Show resolved Hide resolved
toqito/matrix_props/is_stochastic.py Show resolved Hide resolved
toqito/matrix_props/tests/test_is_stochastic.py Outdated Show resolved Hide resolved
@purva-thakre
Copy link
Collaborator Author

Looks like there are still some uncovered cases from the coverage report here: https://github.com/vprusso/toqito/pull/723/checks?check_run_id=28300233677

@vprusso Yes, I brought this up in a previous comment. The lines should not show up as uncovered but they do.

#723 (comment)

Copy link
Owner

@vprusso vprusso left a comment

Choose a reason for hiding this comment

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

LGTM, nice work, @purva-thakre !

@purva-thakre purva-thakre merged commit 2dbffce into master Aug 7, 2024
18 checks passed
@purva-thakre purva-thakre deleted the matrix_props_stochastic branch August 7, 2024 13:41
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.

Feature: Check if matrix is doubly stochastic Feature: Check if matrix stochastic
2 participants