@@ -10,6 +10,12 @@ Trait to describe the operator behavior of the input `x` or type `T`, which can
1010abstract type OperatorStyle end
1111OperatorStyle (x) = OperatorStyle (typeof (x))
1212OperatorStyle (T:: Type ) = throw (MethodError (OperatorStyle, T)) # avoid stackoverflow if not defined
13+ OperatorStyle (x:: OperatorStyle ) = x
14+
15+ OperatorStyle (x, y) = OperatorStyle (OperatorStyle (x):: OperatorStyle , OperatorStyle (y):: OperatorStyle )
16+ OperatorStyle (:: T , :: T ) where {T<: OperatorStyle } = T ()
17+ OperatorStyle (x:: OperatorStyle , y:: OperatorStyle ) = throw (MethodError (OperatorStyle, (x, y)))
18+ @inline OperatorStyle (x, y, zs... ) = OperatorStyle (OperatorStyle (x, y), zs... )
1319
1420struct MPOStyle <: OperatorStyle end
1521struct HamiltonianStyle <: OperatorStyle end
@@ -29,6 +35,12 @@ Trait to describe the geometry of the input `x` or type `T`, which can be either
2935abstract type GeometryStyle end
3036GeometryStyle (x) = GeometryStyle (typeof (x))
3137GeometryStyle (T:: Type ) = throw (MethodError (GeometryStyle, T)) # avoid stackoverflow if not defined
38+ GeometryStyle (x:: GeometryStyle ) = x
39+
40+ GeometryStyle (x, y) = GeometryStyle (GeometryStyle (x):: GeometryStyle , GeometryStyle (y):: GeometryStyle )
41+ GeometryStyle (:: T , :: T ) where {T<: GeometryStyle } = T ()
42+ GeometryStyle (x:: GeometryStyle , y:: GeometryStyle ) = throw (MethodError (GeometryStyle, (x, y)))
43+ @inline GeometryStyle (x, y, zs... ) = GeometryStyle (GeometryStyle (x, y), zs... )
3244
3345struct FiniteChainStyle <: GeometryStyle end
3446struct InfiniteChainStyle <: GeometryStyle end
0 commit comments