Skip to content

Fix sparse realization with vector arguments - #128

Open
LeonidasZhak wants to merge 1 commit into
Bioconductor:develfrom
LeonidasZhak:fix/sparse-vector-realization-123
Open

Fix sparse realization with vector arguments#128
LeonidasZhak wants to merge 1 commit into
Bioconductor:develfrom
LeonidasZhak:fix/sparse-vector-realization-123

Conversation

@LeonidasZhak

Copy link
Copy Markdown

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, while extract_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 to SVT_SparseArray. The no-argument sparse fast path is unchanged. A regression test covers the ConstantArray case.

Tests

  • Full DelayedArray RUnit suite: 43 test functions, 0 errors, 0 failures.
  • HDF5Array reproduction using 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.

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.

Summation of ConstantArray of 0 with vector of 0's fails

1 participant