Skip to content

Commit 68a11ef

Browse files
authored
isone for IsingBimodule (#21)
* get `isone` to return true or false for `IsingBimodule` * test `isone` * remove comment oops * remove boolean comparisons
1 parent 0f0218d commit 68a11ef

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/multifusion.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ function Base.one(a::IsingBimodule)
8585
return IsingBimodule(a.row, a.col, 0)
8686
end
8787

88+
Base.isone(a::IsingBimodule) = leftone(a) == a == rightone(a)
89+
8890
function Base.one(::Type{IsingBimodule})
8991
throw(ArgumentError("one of Type IsingBimodule doesn't exist"))
9092
end

test/multifusion.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Istr = TensorKitSectors.type_repr(I)
2323
@test one(C1) == leftone(M) == rightone(Mop)
2424
@test one(D1) == rightone(M) == leftone(Mop)
2525

26+
@test @constinferred(isone(C0))
27+
@test isone(D0)
28+
@test !isone(C1) && !isone(D1) && !isone(M) && !isone(Mop)
29+
2630
@test eval(Meta.parse(sprint(show, s))) == s
2731
@test @constinferred(hash(s)) == hash(deepcopy(s))
2832
@constinferred dual(s)

0 commit comments

Comments
 (0)