@@ -576,6 +576,37 @@ function Base.:(:)(start::RaggedEnd, step::Integer, stop::Integer)
576576end
577577Base. broadcastable (x:: RaggedRange ) = Ref (x)
578578
579+ # Specialized method for type stability when last index is RaggedEnd with dim=0 (resolved column index)
580+ # This handles the common case: vec[i, end] where end -> RaggedEnd(0, lastindex)
581+ Base. @propagate_inbounds function Base. getindex (
582+ A:: AbstractVectorOfArray , i:: Int , re:: RaggedEnd
583+ )
584+ if re. dim == 0
585+ # Sentinel case: RaggedEnd(0, offset) means offset is the resolved column index
586+ return A. u[re. offset][i]
587+ else
588+ # Non-sentinel case: resolve the ragged index for the last column
589+ col = lastindex (A. u)
590+ resolved_idx = lastindex (A. u[col], re. dim) + re. offset
591+ return A. u[col][i, resolved_idx]
592+ end
593+ end
594+
595+ # Specialized method for type stability when first index is RaggedEnd (row dimension)
596+ # This handles the common case: vec[end, col] where end -> RaggedEnd(1, 0)
597+ Base. @propagate_inbounds function Base. getindex (
598+ A:: AbstractVectorOfArray , re:: RaggedEnd , col:: Int
599+ )
600+ if re. dim == 0
601+ # Sentinel case: RaggedEnd(0, offset) means offset is a plain index
602+ return A. u[col][re. offset]
603+ else
604+ # Non-sentinel case: resolve the ragged index for the given column
605+ resolved_idx = lastindex (A. u[col], re. dim) + re. offset
606+ return A. u[col][resolved_idx]
607+ end
608+ end
609+
579610@inline function _is_ragged_dim (VA:: AbstractVectorOfArray , d:: Integer )
580611 length (VA. u) <= 1 && return false
581612 first_size = size (VA. u[1 ], d)
0 commit comments