@@ -17,7 +17,7 @@ struct Dimensions{N,T<:Tuple} <: AbstractDimensions{N,N}
1717 to:: T
1818
1919 # make sure the elements in the tuple are all AbstractSpace
20- Dimensions (to:: NTuple{N,T } ) where {N,T <: AbstractSpace } = new {N,typeof(to)} (to)
20+ Dimensions (to:: NTuple{N,AbstractSpace } ) where {N} = new {N,typeof(to)} (to)
2121end
2222function Dimensions (dims:: Union{AbstractVector{T},NTuple{N,T}} ) where {T<: Integer ,N}
2323 _non_static_array_warning (" dims" , dims)
@@ -43,12 +43,11 @@ Dimensions(dims::Any) = throw(
4343A structure that describes the left-hand side (`to`) and right-hand side (`from`) Hilbert [`Space`](@ref) of an [`Operator`](@ref).
4444"""
4545struct GeneralDimensions{M,N,T1<: Tuple ,T2<: Tuple } <: AbstractDimensions{M,N}
46- # note that the number `N` should be the same for both `to` and `from`
4746 to:: T1 # space acting on the left
4847 from:: T2 # space acting on the right
4948
5049 # make sure the elements in the tuple are all AbstractSpace
51- GeneralDimensions (to:: NTuple{M,T1 } , from:: NTuple{N,T2 } ) where {M,N,T1 <: AbstractSpace ,T2 <: AbstractSpace } =
50+ GeneralDimensions (to:: NTuple{M,AbstractSpace } , from:: NTuple{N,AbstractSpace } ) where {M,N} =
5251 new {M,N,typeof(to),typeof(from)} (to, from)
5352end
5453function GeneralDimensions (dims:: Union{AbstractVector{T},NTuple{N,T}} ) where {T<: Union{AbstractVector,NTuple} ,N}
@@ -98,3 +97,8 @@ function _get_dims_string(dimensions::GeneralDimensions)
9897 return " [$(string (dims[1 ])) , $(string (dims[2 ])) ]"
9998end
10099_get_dims_string (:: Nothing ) = " nothing" # for EigsolveResult.dimensions = nothing
100+
101+ Base.:(== )(dim1:: Dimensions , dim2:: Dimensions ) = dim1. to == dim2. to
102+ Base.:(== )(dim1:: GeneralDimensions , dim2:: GeneralDimensions ) = (dim1. to == dim2. to) && (dim1. from == dim2. from)
103+ Base.:(== )(dim1:: Dimensions , dim2:: GeneralDimensions ) = false
104+ Base.:(== )(dim1:: GeneralDimensions , dim2:: Dimensions ) = false
0 commit comments