Skip to content

Drop the redundant literal_pow forwards - #241

Open
jishnub wants to merge 1 commit into
JuliaArrays:masterfrom
jishnub:jishnub/fillarrays_bcast_v2
Open

Drop the redundant literal_pow forwards#241
jishnub wants to merge 1 commit into
JuliaArrays:masterfrom
jishnub:jishnub/fillarrays_bcast_v2

Conversation

@jishnub

@jishnub jishnub commented Aug 10, 2026

Copy link
Copy Markdown
Member

Depends on JuliaArrays/FillArrays.jl#385 (FillArrays 1.18) — not on #444. Nothing here calls the new simplify_broadcasted entry point, so the compat bound is raised only to FillArrays = "1.18", and this can land a step ahead of the rest of the chain. CI will not resolve until #385 is merged and released.

Why

infarrays.jl carried four methods forwarding x .^ k on infinite fills to DefaultArrayStyle, one for the all-infinite axis shape and three for the mixed-2D and square-infinite ones, purely to retain the FillArrays simplification.

They are now redundant twice over:

  • FillArrays attaches its literal_pow rules to the operation rather than to a style (as of #385), so x .^ k is simplified before any style is consulted;
  • LazyArrays' generic forward already covers LazyArrayStyle{N} against AbstractFill{T,N} with no axis constraint.

Verification

Rather than trusting the test suite alone, I checked the specific shapes. Against FillArrays 1.18 with LazyArrays master, and with these four methods deleted, the literal_pow testset still passes across 1D, 2D all-infinite, both mixed-2D axis orders and 3D:

Ones(∞) .^ 2 ≡ Ones(∞)          Fill(2,∞) .^ 2 ≡ Fill(4,∞)
Ones(ax...) .^ 2 ≡ Ones(ax...)  for ax in ((∞,∞), (∞,5), (5,∞))
Ones(∞,∞,∞) .^ 2 ≡ Ones(∞,∞,∞)

A behavioural probe over those shapes plus Ones(∞) .* (1:∞), Fill(2,∞) .* (1:∞) and muladd.(Ones(∞), Ones(∞), Ones(∞)) is unchanged.

Full test suite passes.

🤖 Generated with Claude Code

These forwarded `x .^ k` on infinite fills to `DefaultArrayStyle` to retain the
FillArrays simplification, for the all-infinite, mixed-2D and square-infinite axis
shapes.

They are no longer needed. FillArrays attaches its `literal_pow` rules to the
operation rather than to a style, so `x .^ k` is simplified before any style is
consulted, and LazyArrays' generic forward covers `LazyArrayStyle{N}` against
`AbstractFill{T,N}` with no axis constraint besides.

Verified against FillArrays 1.18 with LazyArrays master: the `literal_pow` testset
covering 1D, 2D all-infinite, both mixed-2D orders and 3D still passes with these
methods removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant