Fix sparse realization with vector arguments - #128
Open
LeonidasZhak wants to merge 1 commit into
Open
Conversation
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.
Summary
Fix realization of structurally sparse delayed operations with vector-like arguments.
Thanks to maintainers
Thanks to the DelayedArray and SparseArray maintainers for maintaining these sparse realization interfaces.
Issue or motivation
Closes #123. Adding a zero vector to a zero-valued ConstantArray is structurally sparse, but realization currently fails.
Root cause
is_sparse()identifies the zero-preserving operation, whileextract_sparse_array()passes the sparse block and vector directly to SparseArray. SparseArray does not support this+operation between a sparse object and a vector.Change
When vector-like arguments are present, evaluate the block through
extract_array()and convert the result back toSVT_SparseArray. The no-argument sparse fast path is unchanged. A regression test covers the ConstantArray case.Tests
writeHDF5Array(): passed.R CMD build .: passed, including all three vignettes.R CMD check --no-manual --no-vignettes: passed with 1 WARNING and 2 NOTEs.Scope
This does not change dense extraction, the existing no-argument sparse path, or the SparseArray API.