Skip to content

Commit f9cddcf

Browse files
authored
Add complex(::BraidingTensor) specialization (#226)
1 parent 491aa77 commit f9cddcf

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/tensors/braidingtensor.jl

+5
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ Base.copy(b::BraidingTensor) = b
104104
TensorMap(b::BraidingTensor) = copy!(similar(b), b)
105105
Base.convert(::Type{TensorMap}, b::BraidingTensor) = TensorMap(b)
106106

107+
Base.complex(b::BraidingTensor{<:Complex}) = b
108+
function Base.complex(b::BraidingTensor)
109+
return BraidingTensor{complex(scalartype(b))}(space(b), b.adjoint)
110+
end
111+
107112
function block(b::BraidingTensor, s::Sector)
108113
sectortype(b) == typeof(s) || throw(SectorMismatch())
109114

test/planar.jl

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Vfib = (Vect[FibonacciAnyon](:I => 1, :τ => 2),
7272
@test_throws SpaceMismatch BraidingTensor(W2)
7373

7474
@test adjoint(t1) isa BraidingTensor
75+
@test complex(t1) isa BraidingTensor
76+
@test scalartype(complex(t1)) <: Complex
7577

7678
t3 = @inferred TensorMap(t2)
7779
t4 = braid(id(storagetype(t2), domain(t2)), ((2, 1), (3, 4)), (1, 2, 3, 4))

0 commit comments

Comments
 (0)