Skip to content

Port v3 RaggedEnd for per-column end in ragged arrays#555

Closed
ChrisRackauckas-Claude wants to merge 3 commits intoSciML:masterfrom
ChrisRackauckas-Claude:fix-ragged-end
Closed

Port v3 RaggedEnd for per-column end in ragged arrays#555
ChrisRackauckas-Claude wants to merge 3 commits intoSciML:masterfrom
ChrisRackauckas-Claude:fix-ragged-end

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Implements the v3 RaggedEnd/RaggedRange mechanism in the ragged sublibrary so that r[end, i] returns the last element of column i (not the global max). This matches the original v3 VectorOfArray ragged behavior exactly:

r = RaggedVectorOfArray([[1.0, 2.0], [3.0, 4.0, 5.0]])
r[end, 1]    # 2.0 (last of column 1)
r[end, 2]    # 5.0 (last of column 2)
r[1:end, 1]  # [1.0, 2.0]
r[1:end, 2]  # [3.0, 4.0, 5.0]

lastindex(r, d) returns a RaggedEnd sentinel for leading dimensions, which is resolved per-column at indexing time via _resolve_ragged.

Addresses feedback from @JoshuaLampert in #547.

235 ragged tests pass.

ChrisRackauckas and others added 3 commits April 1, 2026 07:03
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implements the v3 RaggedEnd/RaggedRange mechanism in the ragged sublibrary
so that `r[end, i]` returns the last element of column `i` (not the global
max). This matches the original v3 VectorOfArray ragged behavior exactly:

  r = RaggedVectorOfArray([[1.0, 2.0], [3.0, 4.0, 5.0]])
  r[end, 1]    # 2.0 (last of column 1)
  r[end, 2]    # 5.0 (last of column 2)
  r[1:end, 1]  # [1.0, 2.0]
  r[1:end, 2]  # [3.0, 4.0, 5.0]

`lastindex(r, d)` returns a `RaggedEnd` sentinel for leading dimensions,
which is resolved per-column at indexing time via `_resolve_ragged`.

Addresses feedback from @JoshuaLampert.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the partial reimplementation with the COMPLETE v3 vector_of_array.jl
code, mechanically transformed:
- VectorOfArray → RaggedVectorOfArray
- DiffEqArray → RaggedDiffEqArray
- AbstractVectorOfArray → AbstractRaggedVectorOfArray
- AbstractDiffEqArray → AbstractRaggedDiffEqArray

This preserves ALL v3 behavior exactly:
- A[i] returns the i-th inner array (not scalar)
- A[:, i] returns inner array without zero-padding
- RaggedEnd for per-column `end` resolution
- Iteration over inner arrays
- Full broadcasting, copy, zero, similar, fill!, push!, etc.

Tests are the complete v3 test suite (basic_indexing + interface_tests)
transformed with same type renames, plus new tests for interp/dense,
conversion, SymbolicIndexingInterface, and type hierarchy.

430 tests pass.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants