Skip to content

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented May 10, 2022

Include references to Origin and no_offset_view in the readme, and add a table for badges to make the docs easier to discover.

Comment on lines +112 to +129
julia> D = Diagonal(OffsetArrays.no_offset_view(AO))
4×4 Diagonal{Float64, Vector{Float64}}:
1.0 ⋅ ⋅ ⋅
⋅ 6.0 ⋅ ⋅
⋅ ⋅ 11.0 ⋅
⋅ ⋅ ⋅ 16.0
```

If we want to restore the original indices of `AO`, we may wrap an `OffsetArray` around the `Diagonal` as:

```julia
julia> Origin(AO)(D)
4×4 OffsetArray(::Diagonal{Float64, Vector{Float64}}, 0:3, 0:3) with eltype Float64 with indices 0:3×0:3:
1.0 ⋅ ⋅ ⋅
⋅ 6.0 ⋅ ⋅
⋅ ⋅ 11.0 ⋅
⋅ ⋅ ⋅ 16.0
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the specific 1-based case, I somehow feel the approach in #248 is more useful.

D = no_offset_view_apply(AO) do A
    # do all the normal linear algebra thing in 1-based case
    Diagonal(A)
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It certainly seems useful, might be worth pushing it along.

@jishnub jishnub merged commit a75e3e3 into JuliaArrays:master May 11, 2022
@jishnub jishnub deleted the readme branch May 11, 2022 04:39
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