Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define IndexStyle for AbstractWeights #823

Merged
merged 1 commit into from
Aug 5, 2022
Merged

Define IndexStyle for AbstractWeights #823

merged 1 commit into from
Aug 5, 2022

Conversation

ararslan
Copy link
Member

@ararslan ararslan commented Aug 5, 2022

Since indexing into a weight vector in turn indexes into its vector of values, the optimal index style for a weight vector is the same as that of its values. Currently it uses the default IndexCartesian since no more specific IndexStyle method is defined.

Before this commit:

julia> eachindex(1:3, weights(1:3))
3-element CartesianIndices{1, Tuple{Base.OneTo{Int64}}}:
 CartesianIndex(1,)
 CartesianIndex(2,)
 CartesianIndex(3,)

After:

julia> eachindex(1:3, weights(1:3))
Base.OneTo(3)

Since indexing into a weight vector in turn indexes into its vector of
values, the optimal index style for a weight vector is the same as that
of its values. Currently it uses the default `IndexCartesian` since no
more specific `IndexStyle` method is defined.

Before this commit:
```
julia> eachindex(1:3, weights(1:3))
3-element CartesianIndices{1, Tuple{Base.OneTo{Int64}}}:
 CartesianIndex(1,)
 CartesianIndex(2,)
 CartesianIndex(3,)
 ```

 After:
 ```
julia> eachindex(1:3, weights(1:3))
Base.OneTo(3)
```
@ararslan ararslan requested a review from nalimilan August 5, 2022 05:20
@ararslan ararslan merged commit ee83c65 into master Aug 5, 2022
@ararslan ararslan deleted the aa/windex branch August 5, 2022 15: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