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 array sizing in PLU decomposition #477

Merged
merged 7 commits into from
Apr 2, 2023
Merged

Fix array sizing in PLU decomposition #477

merged 7 commits into from
Apr 2, 2023

Conversation

mhostetter
Copy link
Owner

@mhostetter mhostetter commented Mar 7, 2023

Fixes #476.

# bug_476.py
import numpy as np

import galois

GF = galois.GF(2)

A = GF(
    [
        [1, 0, 0, 0, 0, 1],
        [1, 1, 1, 1, 0, 1],
        [1, 0, 0, 0, 0, 0],
        [0, 1, 0, 0, 0, 0],
        [0, 0, 1, 0, 0, 0],
        [0, 0, 0, 1, 0, 0],
        [0, 0, 0, 0, 1, 0],
        [0, 0, 0, 0, 0, 1],
    ]
)
print(f"A = \n{A}")

P, L, U = A.plu_decompose()
print(f"P = \n{P}")
print(f"L = \n{L}")
print(f"U = \n{U}")

PLU = P @ L @ U
print(f"PLU = \n{PLU}")
print(np.array_equal(A, PLU))
$ python3 bug_476.py
A = 
[[1 0 0 0 0 1]
 [1 1 1 1 0 1]
 [1 0 0 0 0 0]
 [0 1 0 0 0 0]
 [0 0 1 0 0 0]
 [0 0 0 1 0 0]
 [0 0 0 0 1 0]
 [0 0 0 0 0 1]]
P = 
[[1 0 0 0 0 0 0 0]
 [0 1 0 0 0 0 0 0]
 [0 0 0 0 0 1 0 0]
 [0 0 1 0 0 0 0 0]
 [0 0 0 1 0 0 0 0]
 [0 0 0 0 0 0 1 0]
 [0 0 0 0 1 0 0 0]
 [0 0 0 0 0 0 0 1]]
L = 
[[1 0 0 0 0 0 0 0]
 [1 1 0 0 0 0 0 0]
 [0 1 1 0 0 0 0 0]
 [0 0 1 1 0 0 0 0]
 [0 0 0 0 1 0 0 0]
 [1 0 0 0 0 1 0 0]
 [0 0 0 1 0 0 0 0]
 [0 0 0 0 0 1 0 1]]
U =
[[1 0 0 0 0 1]
 [0 1 1 1 0 0]
 [0 0 1 1 0 0]
 [0 0 0 1 0 0]
 [0 0 0 0 1 0]
 [0 0 0 0 0 1]
 [0 0 0 0 0 0]
 [0 0 0 0 0 0]]
PLU =
[[1 0 0 0 0 1]
 [1 1 1 1 0 1]
 [1 0 0 0 0 0]
 [0 1 0 0 0 0]
 [0 0 1 0 0 0]
 [0 0 0 1 0 0]
 [0 0 0 0 1 0]
 [0 0 0 0 0 1]]
True

Fetching follower counts is no longer supported in the new Twitter API
@mhostetter mhostetter added bug-fix Fixes a reported bug linear-algebra Relating to linear algebra routines labels Mar 7, 2023
@mhostetter
Copy link
Owner Author

@davikrehalt Can you install and test this branch? I believe I have a fix in place.

$ python3 -m pip uninstall galois
$ python3 -m pip install git+https://github.com/mhostetter/galois.git@fix-476

@mhostetter mhostetter linked an issue Mar 7, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Mar 7, 2023

Codecov Report

Patch coverage: 87.50% and no project coverage change.

Comparison is base (db0fde5) 96.33% compared to head (afa1572) 96.33%.

Additional details and impacted files
@@              Coverage Diff               @@
##           release/0.3.x     #477   +/-   ##
==============================================
  Coverage          96.33%   96.33%           
==============================================
  Files                 46       46           
  Lines               5833     5833           
==============================================
  Hits                5619     5619           
  Misses               214      214           
Impacted Files Coverage Δ
src/galois/_domains/_linalg.py 95.58% <87.50%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@davikrehalt
Copy link

Yes it works for me!

@mhostetter mhostetter merged commit 485aaf0 into release/0.3.x Apr 2, 2023
@mhostetter mhostetter deleted the fix-476 branch April 2, 2023 14:35
@mhostetter
Copy link
Owner Author

Sorry for the delay in merging this. It is set to be released in 0.3.4.

Until then, you can install it via:

$ python3 -m pip uninstall galois
$ python3 -m pip install git+https://github.com/mhostetter/galois.git@release/0.3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Fixes a reported bug linear-algebra Relating to linear algebra routines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plu_decompose returns IndexError
2 participants