|
1 | 1 | # TensorMap & Tensor: |
2 | 2 | # general tensor implementation with arbitrary symmetries |
3 | 3 | #==========================================================# |
4 | | -#! format: off |
5 | 4 | """ |
6 | 5 | struct TensorMap{T, S<:IndexSpace, N₁, N₂, A<:DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂} |
7 | 6 |
|
8 | 7 | Specific subtype of [`AbstractTensorMap`](@ref) for representing tensor maps (morphisms in |
9 | 8 | a tensor category), where the data is stored in a dense vector. |
10 | 9 | """ |
11 | | -struct TensorMap{T, S<:IndexSpace, N₁, N₂, A<:DenseVector{T}} <: AbstractTensorMap{T, S, N₁, N₂} |
| 10 | +struct TensorMap{T,S<:IndexSpace,N₁,N₂,A<:DenseVector{T}} <: AbstractTensorMap{T,S,N₁,N₂} |
12 | 11 | data::A |
13 | 12 | space::TensorMapSpace{S,N₁,N₂} |
14 | | - |
| 13 | + |
15 | 14 | # uninitialized constructors |
16 | | - function TensorMap{T,S,N₁,N₂,A}(::UndefInitializer, space::TensorMapSpace{S,N₁,N₂}) where {T,S<:IndexSpace,N₁,N₂,A<:DenseVector{T}} |
| 15 | + function TensorMap{T,S,N₁,N₂,A}(::UndefInitializer, |
| 16 | + space::TensorMapSpace{S,N₁,N₂}) where {T,S<:IndexSpace, |
| 17 | + N₁,N₂, |
| 18 | + A<:DenseVector{T}} |
17 | 19 | d = fusionblockstructure(space).totaldim |
18 | 20 | data = A(undef, d) |
19 | 21 | return TensorMap{T,S,N₁,N₂,A}(data, space) |
20 | 22 | end |
21 | | - |
| 23 | + |
22 | 24 | # constructors from data |
23 | | - function TensorMap{T,S,N₁,N₂,A}(data::A, space::TensorMapSpace{S,N₁,N₂}) where {T,S<:IndexSpace,N₁,N₂,A<:DenseVector{T}} |
| 25 | + function TensorMap{T,S,N₁,N₂,A}(data::A, |
| 26 | + space::TensorMapSpace{S,N₁,N₂}) where {T,S<:IndexSpace, |
| 27 | + N₁,N₂, |
| 28 | + A<:DenseVector{T}} |
24 | 29 | T ⊆ field(S) || @warn("scalartype(data) = $T ⊈ $(field(S)))", maxlog = 1) |
25 | 30 | return new{T,S,N₁,N₂,A}(data, space) |
26 | 31 | end |
27 | 32 | end |
28 | | -#! format: on |
29 | 33 |
|
30 | 34 | """ |
31 | 35 | Tensor{T, S, N, A<:DenseVector{T}} = TensorMap{T, S, N, 0, A} |
|
0 commit comments