Skip to content

Commit 4aaf3f8

Browse files
committed
Rename bipermutedimsopadd! to permutedimsopadd! biperm overload
1 parent 32936fc commit 4aaf3f8

2 files changed

Lines changed: 21 additions & 26 deletions

File tree

src/matricize.jl

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -123,41 +123,17 @@ function matricize_axes(a::AbstractArray, ndims_codomain::Val)
123123
return matricize_axes(FusionStyle(a), a, ndims_codomain)
124124
end
125125

126-
# `bipermutedimsopadd!` / `bipermutedimsop` — bipermutation versions of
127-
# `permutedimsopadd!` / `permuteddims` with an element-wise op folded in.
128-
#
129-
# These are intended to become the primary overload points for downstream array
130-
# types that want to fold ops into a bipartitioned permutation copy (e.g., fuse
131-
# `conj` into the copy, or use lazy wrappers like `StridedView` with op metadata).
132-
# For now, `bipermutedimsopadd!` delegates to the flat-permutation `permutedimsopadd!`.
133-
# In a future PR, the dependency will flip so that `permutedimsopadd!` wraps
134-
# `bipermutedimsopadd!`.
135-
136-
"""
137-
bipermutedimsopadd!(dest, op, src, perm_codomain, perm_domain, α, β)
138-
139-
Like `permutedimsopadd!`, but takes a bipartitioned permutation
140-
`(perm_codomain, perm_domain)`.
141-
"""
142-
function bipermutedimsopadd!(
143-
dest::AbstractArray, op, src::AbstractArray,
144-
perm_codomain, perm_domain,
145-
α::Number, β::Number
146-
)
147-
return permutedimsopadd!(dest, op, src, (perm_codomain..., perm_domain...), α, β)
148-
end
149-
150126
"""
151127
bipermutedimsop(op, src, perm_codomain, perm_domain)
152128
153-
Non-mutating version of `bipermutedimsopadd!`: returns
129+
Non-mutating version of bipermutation `permutedimsopadd!`: returns
154130
`op.(permutedims(src, (perm_codomain..., perm_domain...)))`. Has "maybe alias"
155131
semantics — the result may be a view/wrapper aliasing `src` or a fresh copy.
156132
"""
157133
function bipermutedimsop(op, src::AbstractArray, perm_codomain, perm_domain)
158134
perm = (perm_codomain..., perm_domain...)
159135
dest = similar(src, map(i -> size(src, i), perm))
160-
return bipermutedimsopadd!(dest, op, src, perm_codomain, perm_domain, true, false)
136+
return permutedimsopadd!(dest, op, src, perm_codomain, perm_domain, true, false)
161137
end
162138

163139
# Inner version takes a list of sub-permutations, overload this one if needed.

src/permutedimsadd.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,25 @@ function permutedimsopadd!(
5858
return dest
5959
end
6060

61+
# Bipartitioned permutation overload. Intended to become a primary overload point
62+
# for downstream array types that want to fold ops into a bipartitioned permutation
63+
# copy (e.g., fuse `conj` into the copy, or use lazy wrappers like `StridedView`
64+
# with op metadata). For now it delegates to the flat-permutation version by
65+
# concatenating the perms; in a future PR the dependency will flip.
66+
67+
"""
68+
permutedimsopadd!(dest, op, src, perm_codomain, perm_domain, α, β)
69+
70+
Like `permutedimsopadd!`, but takes a bipartitioned permutation as two tuples.
71+
"""
72+
function permutedimsopadd!(
73+
dest::AbstractArray, op, src::AbstractArray,
74+
perm_codomain, perm_domain,
75+
α::Number, β::Number
76+
)
77+
return permutedimsopadd!(dest, op, src, (perm_codomain..., perm_domain...), α, β)
78+
end
79+
6180
# ---------------------------------------------------------------------------- #
6281
# Convenience functions that lower to permutedimsopadd!
6382
# ---------------------------------------------------------------------------- #

0 commit comments

Comments
 (0)