Commit 63c3de8
Fix view of VectorOfArray with heterogeneous array sizes
Fixes #453
The issue was that `view(f, :, i)` for a VectorOfArray with
heterogeneous inner array sizes returned incorrect results. The
problem was that `to_indices` uses `axes`, which is based on the
first element's size, causing views of columns with different sizes
to have incorrect dimensions.
Solution: Added special handling for `view(A, :, i)` where `i` is
an Int, to use the actual size of the specific column being viewed
rather than relying on `to_indices`.
Changes:
- Modified Base.view for AbstractVectorOfArray to handle heterogeneous
arrays by computing the correct indices based on the actual column size
- Added comprehensive tests for views of heterogeneous arrays including:
* Testing correct lengths of views
* Testing that views match regular indexing
* Testing that views can be modified
All existing tests pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 9193003 commit 63c3de8
2 files changed
+34
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
675 | 675 | | |
676 | 676 | | |
677 | 677 | | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
678 | 687 | | |
679 | 688 | | |
680 | 689 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
148 | 173 | | |
149 | 174 | | |
150 | 175 | | |
| |||
0 commit comments