Skip to content

Commit 3354f8a

Browse files
Yue-Zhengyuanlkdvos
authored andcommitted
Fix tensor map subtype bounds
1 parent 35ed557 commit 3354f8a

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎src/tensors/abstracttensor.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Abstract Tensor type
44
#----------------------
55
"""
6-
abstract type AbstractTensorMap{T<:Number, S<:IndexSpace, N₁, N₂} end
6+
abstract type AbstractTensorMap{T <: Number, S <: IndexSpace, N₁, N₂} end
77
88
Abstract supertype of all tensor maps, i.e. linear maps between tensor products of vector
99
spaces of type `S<:IndexSpace`, with element type `T`. An `AbstractTensorMap` maps from an
@@ -12,7 +12,7 @@ input space of type `ProductSpace{S, N₂}` to an output space of type `ProductS
1212
abstract type AbstractTensorMap{T <: Number, S <: IndexSpace, N₁, N₂} end
1313

1414
"""
15-
AbstractTensor{T,S,N} = AbstractTensorMap{T,S,N,0}
15+
AbstractTensor{T, S, N} = AbstractTensorMap{T, S, N, 0}
1616
1717
Abstract supertype of all tensors, i.e. elements in the tensor product space of type
1818
`ProductSpace{S, N}`, with element type `T`.

‎src/tensors/adjoint.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# AdjointTensorMap: lazy adjoint
22
#==========================================================#
33
"""
4-
struct AdjointTensorMap{T, S, N₁, N₂, TT<:AbstractTensorMap} <: AbstractTensorMap{T, S, N₁, N₂}
4+
struct AdjointTensorMap{T <: Number, S <: IndexSpace, N₁, N₂, TT <: AbstractTensorMap} <: AbstractTensorMap{T, S, N₁, N₂}
55
66
Specific subtype of [`AbstractTensorMap`](@ref) that is a lazy wrapper for representing the
77
adjoint of an instance of [`AbstractTensorMap`](@ref).
88
"""
9-
struct AdjointTensorMap{T, S, N₁, N₂, TT <: AbstractTensorMap{T, S, N₂, N₁}} <:
9+
struct AdjointTensorMap{T <: Number, S <: IndexSpace, N₁, N₂, TT <: AbstractTensorMap{T, S, N₂, N₁}} <:
1010
AbstractTensorMap{T, S, N₁, N₂}
1111
parent::TT
1212
end

‎src/tensors/braidingtensor.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# special (2,2) tensor that implements a standard braiding operation
33
#====================================================================#
44
"""
5-
struct BraidingTensor{T, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2}
5+
struct BraidingTensor{T <: Number, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2}
66
BraidingTensor(V1::S, V2::S, adjoint::Bool=false) where {S<:IndexSpace}
77
BraidingTensor{T, S, A}(V1::S, V2::S, adjoint::Bool=false) where {T, S, A}
88
@@ -14,7 +14,7 @@ It holds that `domain(BraidingTensor(V1, V2)) == V1 ⊗ V2` and
1414
controls the array type of the braiding tensor used when indexing
1515
and multiplying with other tensors.
1616
"""
17-
struct BraidingTensor{T, S, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2}
17+
struct BraidingTensor{T <: Number, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 2, 2}
1818
V1::S
1919
V2::S
2020
adjoint::Bool

‎src/tensors/diagonal.jl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DiagonalTensorMap
22
#==========================================================#
3-
struct DiagonalTensorMap{T, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 1, 1}
3+
struct DiagonalTensorMap{T <: Number, S <: IndexSpace, A <: DenseVector{T}} <: AbstractTensorMap{T, S, 1, 1}
44
data::A
55
domain::S # equals codomain
66

@@ -33,9 +33,9 @@ storagetype(::Type{<:DiagonalTensorMap{T, S, A}}) where {T, S, A <: DenseVector{
3333
#--------------------------------
3434
# undef constructors
3535
"""
36-
DiagonalTensorMap{T}(undef, domain::S) where {T,S<:IndexSpace}
36+
DiagonalTensorMap{T}(undef, domain::S) where {T, S <: IndexSpace}
3737
# expert mode: select storage type `A`
38-
DiagonalTensorMap{T,S,A}(undef, domain::S) where {T,S<:IndexSpace,A<:DenseVector{T}}
38+
DiagonalTensorMap{T, S, A}(undef, domain::S) where {T, S <: IndexSpace, A <: DenseVector{T}}
3939
4040
Construct a `DiagonalTensorMap` with uninitialized data.
4141
"""

‎src/tensors/tensor.jl‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# general tensor implementation with arbitrary symmetries
33
#==========================================================#
44
"""
5-
struct TensorMap{T, S<:IndexSpace, N₁, N₂, A<:DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂}
5+
struct TensorMap{T <: Number, S <: IndexSpace, N₁, N₂, A <: DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂}
66
77
Specific subtype of [`AbstractTensorMap`](@ref) for representing tensor maps (morphisms in
88
a tensor category), where the data is stored in a dense vector.
99
"""
10-
struct TensorMap{T, S <: IndexSpace, N₁, N₂, A <: DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂}
10+
struct TensorMap{T <: Number, S <: IndexSpace, N₁, N₂, A <: DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂}
1111
data::A
1212
space::TensorMapSpace{S, N₁, N₂}
1313

@@ -20,15 +20,15 @@ struct TensorMap{T, S <: IndexSpace, N₁, N₂, A <: DenseVector{T}} <: Abstrac
2020
end
2121

2222
"""
23-
Tensor{T, S, N, A<:DenseVector{T}} = TensorMap{T, S, N, 0, A}
23+
Tensor{T <: Number, S <: IndexSpace, N, A <: DenseVector{T}} = TensorMap{T, S, N, 0, A}
2424
2525
Specific subtype of [`AbstractTensor`](@ref) for representing tensors whose data is stored
2626
in a dense vector.
2727
2828
A `Tensor{T, S, N, A}` is actually a special case `TensorMap{T, S, N, 0, A}`,
2929
i.e. a tensor map with only a non-trivial output space.
3030
"""
31-
const Tensor{T, S, N, A} = TensorMap{T, S, N, 0, A}
31+
const Tensor{T <: Number, S <: IndexSpace, N, A <: DenseVector{T}} = TensorMap{T, S, N, 0, A}
3232

3333
# Utility functions:
3434
# ------------------

0 commit comments

Comments
 (0)