Skip to content

Commit

Permalink
arguments for QuasiAdj/Trans broadcasting
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Nov 10, 2024
1 parent 8ea2da1 commit 0648693
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QuasiArrays"
uuid = "c4ea9172-b204-11e9-377d-29865faadc5c"
authors = ["Sheehan Olver <[email protected]>"]
version = "0.11.7"
version = "0.11.8"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
3 changes: 2 additions & 1 deletion src/QuasiArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ import LazyArrays: MemoryLayout, UnknownLayout, Mul, ApplyLayout, BroadcastLayou
LdivStyle, InvLayout, PInvLayout, sub_materialize, lazymaterialize,
_mul, rowsupport, DiagonalLayout, adjointlayout, transposelayout, conjlayout,
sublayout, call, LazyArrayStyle, layout_getindex, _broadcast2broadcastarray, _applyarray_summary, _broadcastarray_summary,
_broadcasted_mul, simplifiable, simplify, _mul_colsupport, _mul_rowsupport
_broadcasted_mul, simplifiable, simplify, _mul_colsupport, _mul_rowsupport,
_adjoint, _transpose

import Base.IteratorsMD

Expand Down
8 changes: 8 additions & 0 deletions src/quasiadjtrans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ BroadcastStyle(::Type{<:QuasiTranspose{<:Any,<:Inclusion}}) = LazyQuasiArrayStyl



###
# broadcast support
###

arguments(b::BroadcastLayout, A::QuasiAdjoint) = map(_adjoint, arguments(b, parent(A)))
arguments(b::BroadcastLayout, A::QuasiTranspose) = map(_transpose, arguments(b, parent(A)))


###
# adjoint concat support
###
Expand Down
8 changes: 8 additions & 0 deletions test/test_quasibroadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,12 @@ import QuasiArrays: QuasiCartesianIndex, QuasiCartesianIndices, DefaultQuasiArra
A[ones(Int)] .+= 1
@test A == [2,1,1,1]
end

@testset "adjoint arguments" begin
a = QuasiVector(randn(6), 0:0.5:2.5)
@test MemoryLayout(BroadcastQuasiArray(*, 2, a)') isa LazyArrays.BroadcastLayout
@test MemoryLayout(transpose(BroadcastQuasiArray(*, 2, a))) isa LazyArrays.BroadcastLayout
@test LazyArrays.arguments(BroadcastQuasiArray(*, 2, a)') == (2, a')
@test LazyArrays.arguments(transpose(BroadcastQuasiArray(*, 2, a))) == (2, transpose(a))
end
end

0 comments on commit 0648693

Please sign in to comment.