ENH: Create bindings for KLU#149
Merged
Merged
Conversation
Remove manual permutation tests from test_cholmod.
Parametrize test_ldlupdown over `order`. Remove `N` argument from _create_update_matrix. Some random seeds cause failues on order=None and 'natural'. Unclear exactly what is causing this issue. The random update matrix we create likely creates structural issues that aren't resolved by a fill-reducing permutation. Need to investigate further.
See TODO note on whether we should un-permute the input matrix.
This update makes the CholeskyFactor.resymbol method API identical to the procedural ldlupdate interface. It is likely more consistent with how the function will actually be used, where the user has already permuted the input matrix with the fill-reducing permutation by the time multiple up/downdates have been computed and a resymbol is needed.
This commit removes the cholmod, ldlsolve, ldlupdate, ldlrowmod, and resymbol functions, in favor of their counterparts in the CholeskyFactor object.
Use raw .data pointers in _cholmod_sparse_from_csc and _cholmod_dense_from_ndarray. This commit removes the unnecessary memoryviews since we are just passing a pointer, not doing any indexing. The pointer also works for empty arrays, so we can handle those directly in the function and not have special cases.
Add more notes to factorize docstring.
These CholeskyFactor properties now return np.ndarrays that are read-only views on the underlying data.
The factor attribute is assigned in __cinit__ and should *never* be set to NULL by the cholmod functions to which it is an argument. Only its internal components are called. We also handle errors immediately after these functions are called, so CholeskyFactor.factor should never be NULL after initialization.
This was referenced Nov 5, 2025
Remove the memcpy calls, which also take the pointers.
Use assertions on internal cdef functions. No need to raise ValueErrors there.
Also do some cython-lint linting.
The value of src.worksize *is* the entire size, so just pass "1" instead of "sizeof(...)" to _malloc_copy.
This commit allows _malloc_copy to return NULL without error. It also checks for src/dest.LUsize and src/dest.LUbx are non-NULL before dereferencing them within the for-loop.
This commit eliminates the need for a separate copy function for klu_symbolic and klu_l_symbolic, as well as klu_numeric and klu_l_numeric. It is a bit hacky, since we need an if-statement based on the input types to generate unreachable code that will be pruned before compilation, but it works and saves code duplication.
This commit makes the ternary statements much more readable.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an interface to the SuiteSparse KLU package. It is built on top of the development branch in #145, so it will show many more commits before that is merged.