@@ -4,7 +4,7 @@ This file defines the Dimensions structures, which can describe composite Hilber
44
55export AbstractDimensions, Dimensions, GeneralDimensions
66
7- abstract type AbstractDimensions{N,M } end
7+ abstract type AbstractDimensions{M,N } end
88
99@doc raw """
1010 struct Dimensions{N,T<:Tuple} <: AbstractDimensions{N, N}
@@ -42,14 +42,14 @@ Dimensions(dims::Any) = throw(
4242
4343A structure that describes the left-hand side (`to`) and right-hand side (`from`) Hilbert [`Space`](@ref) of an [`Operator`](@ref).
4444"""
45- struct GeneralDimensions{N,M, T1<: Tuple ,T2<: Tuple } <: AbstractDimensions{N,M }
45+ struct GeneralDimensions{M,N, T1<: Tuple ,T2<: Tuple } <: AbstractDimensions{M,N }
4646 # note that the number `N` should be the same for both `to` and `from`
4747 to:: T1 # space acting on the left
4848 from:: T2 # space acting on the right
4949
5050 # make sure the elements in the tuple are all AbstractSpace
51- GeneralDimensions (to:: NTuple{N ,T1} , from:: NTuple{M ,T2} ) where {N,M ,T1<: AbstractSpace ,T2<: AbstractSpace } =
52- new {N,M ,typeof(to),typeof(from)} (to, from)
51+ GeneralDimensions (to:: NTuple{M ,T1} , from:: NTuple{N ,T2} ) where {M,N ,T1<: AbstractSpace ,T2<: AbstractSpace } =
52+ new {M,N ,typeof(to),typeof(from)} (to, from)
5353end
5454function GeneralDimensions (dims:: Union{AbstractVector{T},NTuple{N,T}} ) where {T<: Union{AbstractVector,NTuple} ,N}
5555 (length (dims) != 2 ) && throw (ArgumentError (" Invalid dims = $dims " ))
@@ -59,9 +59,8 @@ function GeneralDimensions(dims::Union{AbstractVector{T},NTuple{N,T}}) where {T<
5959
6060 L1 = length (dims[1 ])
6161 L2 = length (dims[2 ])
62- ((L1 > 0 ) && (L2 > 0 )) || throw (
63- DomainError ((L1, L2), " The length of the arguments `dims[1]` and `dims[2]` must have at least one element." ),
64- )
62+ (L1 > 0 ) || throw (DomainError (L1, " The length of `dims[1]` must be larger or equal to 1." ))
63+ (L2 > 0 ) || throw (DomainError (L2, " The length of `dims[2]` must be larger or equal to 1." ))
6564
6665 return GeneralDimensions (Tuple (Space .(dims[1 ])), Tuple (Space .(dims[2 ])))
6766end
0 commit comments