Skip to content

Fix LocalOperator constructor for indices of type Tuple{Int,Int}#176

Merged
pbrehmer merged 4 commits intomasterfrom
pb-fix-localoperator-indices
Apr 11, 2025
Merged

Fix LocalOperator constructor for indices of type Tuple{Int,Int}#176
pbrehmer merged 4 commits intomasterfrom
pb-fix-localoperator-indices

Conversation

@pbrehmer
Copy link
Collaborator

Previously, tuple-typed indices would lead to an error since the inner constructor uses a PeriodicArray (which apparently can only be indexed using CartesianIndices). Now, I convert tuple indices to CartesianIndices such that internally always the same type is used but users can still use tuple indices (which we also do in the docstring).

@lkdvos
Copy link
Member

lkdvos commented Apr 11, 2025

This is not something specific to PeriodicArray actually: if you use a tuple of Int you need to splat them to make the indexing work. What was actually breaking before?

@pbrehmer
Copy link
Collaborator Author

The thing that made it break was this line:

for i in 1:length(inds)
    @assert space(operator, i) == plattice[inds[i]]
end

since the tuples weren't splatted.

@pbrehmer pbrehmer enabled auto-merge (squash) April 11, 2025 16:04
@codecov
Copy link

codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/operators/localoperator.jl 80.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/algorithms/select_algorithm.jl 95.83% <100.00%> (ø)
src/operators/localoperator.jl 59.09% <80.00%> (+0.60%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pbrehmer pbrehmer merged commit 115089f into master Apr 11, 2025
39 checks passed
@pbrehmer pbrehmer deleted the pb-fix-localoperator-indices branch April 14, 2025 07:53
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