Skip to content

Commit bb74ee8

Browse files
committed
implement changes
1 parent 9b7905c commit bb74ee8

File tree

6 files changed

+12
-19
lines changed

6 files changed

+12
-19
lines changed

src/operators/abstractmpo.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ abstract type AbstractMPO{O} <: AbstractVector{O} end
1111
const SparseMPO{O <: SparseBlockTensorMap} = AbstractMPO{O}
1212

1313
# By default, define things in terms of parent
14+
Base.isfinite(mpo::AbstractMPO) = isfinite(typeof(mpo))
1415
Base.size(mpo::AbstractMPO, args...) = size(parent(mpo), args...)
1516
Base.length(mpo::AbstractMPO) = length(parent(mpo))
1617
eachsite(mpo::AbstractMPO) = eachindex(mpo)

src/states/windowmps.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ struct WindowMPS{A <: GenericMPSTensor, B <: MPSBondTensor} <: AbstractFiniteMPS
5050
end
5151
end
5252

53-
GeometryStyle(::Type{<:WindowMPS}) = WindowChainStyle()
54-
5553
#===========================================================================================
5654
Constructors
5755
===========================================================================================#

src/utility/multiline.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function Base.axes(m::Multiline, i::Int)
2929
i == 2 ? axes(parent(m)[1], 1) : throw(ArgumentError("Invalid index $i"))
3030
end
3131
Base.eachindex(m::Multiline) = CartesianIndices(size(m))
32+
Base.isfinite(m::Multiline) = isfinite(typeof(m))
3233

3334
eachsite(m::Multiline) = eachsite(first(parent(m)))
3435

src/utility/styles.jl

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
"""
2-
`OperatorStyle`
2+
abstract type OperatorStyle end
33
44
Holy trait used as a dispatch tag for operator representations.
55
Concrete subtypes (`MPOStyle` and `HamiltonianStyle`) indicate
6-
whether an operator is stored as an MPO or as a Hamiltonian.
7-
Use `OperatorStyle` in method signatures to select implementation-
8-
specific code paths for different operator types.
6+
whether an operator represents a Hamiltonian operator (sum of terms)
7+
or a transfer matrix (product of factors).
98
109
To opt a custom operator type into this dispatch scheme implement:
1110
```julia
12-
OperatorStyle(::T) where {T<:YourOperatorType}
11+
OperatorStyle(::T) where {T <: YourOperatorType}
1312
```
1413
"""
1514
abstract type OperatorStyle end
@@ -21,17 +20,16 @@ struct HamiltonianStyle <: OperatorStyle end
2120

2221

2322
"""
24-
`GeometryStyle`
23+
abstract type GeometryStyle end
2524
2625
Holy trait used as a dispatch tag to distinguish between different
2726
geometries Concrete subtypes
28-
(`FiniteChainStyle`, `InfiniteChainStyle` and `WindowChainStyle`) indicate whether a system is
29-
finite, infinite or a finite window in an infinite chain. Use `GeometryStyle` in method signatures to
30-
select implementation-specific code paths for different types.
27+
(`FiniteChainStyle`, `InfiniteChainStyle`) indicate whether a system is
28+
a finite or infinite chain.
3129
3230
To opt a custom type into this dispatch scheme implement:
3331
```julia
34-
GeometryStyle(::T) where {T<:YourType}
32+
GeometryStyle(::T) where {T <: YourType}
3533
```
3634
"""
3735
abstract type GeometryStyle end
@@ -40,4 +38,3 @@ GeometryStyle(T::Type) = throw(MethodError(GeometryStyle, T)) # avoid stackoverf
4038

4139
struct FiniteChainStyle <: GeometryStyle end
4240
struct InfiniteChainStyle <: GeometryStyle end
43-
struct WindowChainStyle <: GeometryStyle end

test/operators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module TestOperators
1010
using MPSKit
1111
using MPSKit: _transpose_front, _transpose_tail, C_hamiltonian, AC_hamiltonian,
1212
AC2_hamiltonian
13-
using MPSKit: GeometryStyle, FiniteChainStyle, InfiniteChainStyle, WindowChainStyle, OperatorStyle, MPOStyle,
13+
using MPSKit: GeometryStyle, FiniteChainStyle, InfiniteChainStyle, OperatorStyle, MPOStyle,
1414
HamiltonianStyle
1515
using TensorKit
1616
using TensorKit:

test/states.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module TestStates
99
using Test, TestExtras
1010
using MPSKit
1111
using MPSKit: _transpose_front, _transpose_tail
12-
using MPSKit: GeometryStyle, FiniteChainStyle, InfiniteChainStyle, WindowChainStyle
12+
using MPSKit: GeometryStyle, FiniteChainStyle, InfiniteChainStyle
1313
using MPSKit: TransferMatrix
1414
using TensorKit
1515
using TensorKit:
@@ -190,10 +190,6 @@ module TestStates
190190
# constructor 2 - used to take a "slice" from an infinite mps
191191
window_2 = WindowMPS(gs, 10)
192192

193-
@test GeometryStyle(typeof(window_1)) == WindowChainStyle()
194-
@test GeometryStyle(window_1) == WindowChainStyle()
195-
@test GeometryStyle(window_1) == GeometryStyle(window_2)
196-
197193
@test eltype(window_1) == eltype(typeof(window_1))
198194

199195
P = @constinferred physicalspace(window_2)

0 commit comments

Comments
 (0)