Skip to content

Commit 3db8b59

Browse files
authored
Copy of BroadcastQuasiArray returns array (#45)
* overload copy * Update Project.toml * Update test_quasibroadcast.jl * Overload ==
1 parent a0ce23f commit 3db8b59

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "QuasiArrays"
22
uuid = "c4ea9172-b204-11e9-377d-29865faadc5c"
33
authors = ["Sheehan Olver <solver@mac.com>"]
4-
version = "0.3.1"
4+
version = "0.3.2"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/lazyquasiarrays.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ size(A::BroadcastQuasiArray) = map(length, axes(A))
118118

119119
IndexStyle(::BroadcastQuasiArray{<:Any,1}) = IndexLinear()
120120

121+
function ==(A::BroadcastQuasiArray, B::BroadcastQuasiArray)
122+
A.f == B.f && all(A.args .== B.args) && return true
123+
error("Not implemented")
124+
end
125+
copy(A::BroadcastQuasiArray) = A # BroadcastQuasiArray are immutable
126+
121127
@propagate_inbounds getindex(A::BroadcastQuasiArray, kj::Number...) = broadcasted(A)[kj...]
122128
@propagate_inbounds getindex(A::BroadcastQuasiArray{T,N}, kj::QuasiCartesianIndex{N}) where {T,N} =
123129
A[kj.I...]

test/test_quasibroadcast.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ import QuasiArrays: QuasiCartesianIndex, QuasiCartesianIndices, DefaultQuasiArra
129129

130130
@test axes(exp.(A)) == axes(B)
131131
@test QuasiMatrix(B) == exp.(A)
132+
@test copy(B) B
132133

133134
C = BroadcastQuasiArray(+, A, 2)
134135
@test C == A .+ 2

0 commit comments

Comments
 (0)