Skip to content

Commit e5556df

Browse files
authored
reshape(::OneToOne) (#10)
1 parent fc0668a commit e5556df

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-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 = "TensorProducts"
22
uuid = "decf83d6-1968-43f4-96dc-fdb3fe15fc6d"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.1.5"
4+
version = "0.1.6"
55

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

src/onetoone.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ struct OneToOne{T} <: AbstractUnitRange{T} end
55
OneToOne() = OneToOne{Int}()
66
Base.first(a::OneToOne) = one(eltype(a))
77
Base.last(a::OneToOne) = one(eltype(a))
8+
9+
# impose Int64 to keep Base.to_shape(::Base.OneTo) convention
10+
Base.to_shape(::OneToOne) = 1

test/test_basics.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ using TensorProducts: OneToOne
1212
@test length(a0) == 1
1313

1414
@test blockaxes(OneToOne()) == (BlockRange(OneToOne()),)
15+
@test Base.to_shape(OneToOne()) isa Int64
16+
@test Base.to_shape(OneToOne()) == 1
1517
end

0 commit comments

Comments
 (0)