Skip to content

Commit 54cd48a

Browse files
authored
Generalize axes type in similar (#7)
1 parent 7eb11cf commit 54cd48a

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BroadcastMapConversion"
22
uuid = "4a4adec5-520f-4750-bb37-d5e66b4ddeb2"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.1.3"
4+
version = "0.1.4"
55

66
[deps]
77
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"

src/BroadcastMapConversion.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function mapped(f, args...)
165165
end
166166

167167
Base.similar(m::Mapped, elt::Type) = similar(Broadcasted(m), elt)
168-
Base.similar(m::Mapped, elt::Type, ax::Tuple) = similar(Broadcasted(m), elt, ax)
168+
Base.similar(m::Mapped, elt::Type, ax) = similar(Broadcasted(m), elt, ax)
169169
Base.axes(m::Mapped) = axes(Broadcasted(m))
170170
# Equivalent to:
171171
# map(m.f, m.args...)

test/test_basics.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ using Test: @inferred, @test, @test_throws, @testset
2121
@test axes(m′) == axes(bc)
2222
@test copyto!(similar(m, elt), m) ref
2323
@test copyto!(similar(m′, elt), m) ref
24+
x = similar(m, Float32, Base.OneTo.((3, 2)))
25+
@test x isa Matrix{Float32}
26+
@test size(x) == (3, 2)
2427
end
2528

2629
@test @inferred is_map_expr(

0 commit comments

Comments
 (0)