Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
__pycache__
.ipynb*
*Manifest.toml
*LocalPreferences.toml
.vscode
experimental
refs
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/adjoint.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# AdjointTensorMap: lazy adjoint
#==========================================================#
"""
struct AdjointTensorMap{T, S, N₁, N₂, TT<:AbstractTensorMap} <: AbstractTensorMap{T, S, N₁, N₂}
struct AdjointTensorMap{T<:Number, S<:IndexSpace, N₁, N₂, TT<:AbstractTensorMap} <: AbstractTensorMap{T, S, N₁, N₂}

Specific subtype of [`AbstractTensorMap`](@ref) that is a lazy wrapper for representing the
adjoint of an instance of [`AbstractTensorMap`](@ref).
"""
struct AdjointTensorMap{T, S, N₁, N₂, TT <: AbstractTensorMap{T, S, N₂, N₁}} <:
struct AdjointTensorMap{T <: Number, S <: IndexSpace, N₁, N₂, TT <: AbstractTensorMap{T, S, N₂, N₁}} <:
AbstractTensorMap{T, S, N₁, N₂}
parent::TT
end
Expand Down
4 changes: 2 additions & 2 deletions src/tensors/braidingtensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# special (2,2) tensor that implements a standard braiding operation
#====================================================================#
"""
struct BraidingTensor{T, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2}
struct BraidingTensor{T <: Number, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2}
BraidingTensor(V1::S, V2::S, adjoint::Bool=false) where {S<:IndexSpace}
BraidingTensor{T, S, A}(V1::S, V2::S, adjoint::Bool=false) where {T, S, A}

Expand All @@ -14,7 +14,7 @@ It holds that `domain(BraidingTensor(V1, V2)) == V1 ⊗ V2` and
controls the array type of the braiding tensor used when indexing
and multiplying with other tensors.
"""
struct BraidingTensor{T, S, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2}
struct BraidingTensor{T <: Number, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2}
V1::S
V2::S
adjoint::Bool
Expand Down
2 changes: 1 addition & 1 deletion src/tensors/diagonal.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DiagonalTensorMap
#==========================================================#
struct DiagonalTensorMap{T, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 1, 1}
struct DiagonalTensorMap{T <: Number, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 1, 1}
data::A
domain::S # equals codomain

Expand Down
4 changes: 2 additions & 2 deletions src/tensors/tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# general tensor implementation with arbitrary symmetries
#==========================================================#
"""
struct TensorMap{T, S<:IndexSpace, N₁, N₂, A<:DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂}
struct TensorMap{T<:Number, S<:IndexSpace, N₁, N₂, A<:DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂}

Specific subtype of [`AbstractTensorMap`](@ref) for representing tensor maps (morphisms in
a tensor category), where the data is stored in a dense vector.
"""
struct TensorMap{T, S <: IndexSpace, N₁, N₂, A <: DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂}
struct TensorMap{T <: Number, S <: IndexSpace, N₁, N₂, A <: DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂}
data::A
space::TensorMapSpace{S, N₁, N₂}

Expand Down
12 changes: 12 additions & 0 deletions test/tensors/subtyping.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Test
using TensorKit
using TensorKit: AdjointTensorMap

@testset "Tensor map subtyping" begin
for TT in (TensorMap, DiagonalTensorMap, AdjointTensorMap, BraidingTensor)
@test TT <: AbstractTensorMap
for T in (Float64, ComplexF64)
@test TT{T} <: AbstractTensorMap{T}
end
end
end
Loading