diff --git a/Project.toml b/Project.toml index 52723ba..946d87b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DirectSum" uuid = "22fd7b30-a8c0-5bf2-aabe-97783860d07c" authors = ["Michael Reed"] -version = "0.2.4" +version = "0.2.5" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/indices.jl b/src/indices.jl index d73f551..3b851b0 100644 --- a/src/indices.jl +++ b/src/indices.jl @@ -10,7 +10,7 @@ end @pure Base.ndims(::Dim{N}) where N = N # vector and co-vector prefix -const pre = ("v","w","ϵ","∂") +const pre = ("v","w","∂","ϵ") # vector space and dual-space symbols const vsn = (:V,:VV,:W) @@ -126,10 +126,10 @@ end @inline printindices(io::IO,a::VTI,b::VTI,l::Bool=false,e::String=pre[1],f::String=pre[2]) = printindices(io,a,b,Int[],Int[],l,e,f) @inline function printindices(io::IO,a::VTI,b::VTI,c::VTI,d::VTI,l::Bool=false,e::String=pre[1],f::String=pre[2],g::String=pre[3],h::String=pre[4]) A,B,C,D = isempty(a),!isempty(b),!isempty(c),!isempty(d) + D && printindices(io,d,l,h) + C && printindices(io,c,l,g) !((B || C || D) && A) && printindices(io,a,l,e) B && printindices(io,b,l,f) - C && printindices(io,c,l,g) - D && printindices(io,d,l,h) end @pure printindices(io::IO,V::T,e::Bits,label::Bool=false) where T<:VectorSpace = printlabel(io,V,e,label,pre...) diff --git a/src/operations.jl b/src/operations.jl index d83c461..d174bed 100644 --- a/src/operations.jl +++ b/src/operations.jl @@ -89,6 +89,9 @@ for op ∈ (:*,:∪) end end +∪(x::T) where T<:VectorSpace = x +∪(a::A,b::B,c::C...) where {A<:VectorSpace,B<:VectorSpace,C<:VectorSpace} = ∪(a∪b,c...) + @pure ∩(a::T,::Q) where {T<:VectorSpace{N,M,S},Q<:VectorSpace{N,M,S}} where {N,M,S} = a @pure ∩(a::T,::S) where {T<:VectorSpace{N},S<:VectorSpace{N}} where N = V0 @pure function ∩(a::T,b::S) where {T<:VectorSpace{N1,M1,S1},S<:VectorSpace{N2,M2,S2}} where {N1,M1,S1,N2,M2,S2} @@ -104,6 +107,9 @@ end end end +∩(x::T) where T<:VectorSpace = x +∩(a::A,b::B,c::C...) where {A<:VectorSpace,B<:VectorSpace,C<:VectorSpace} = ∩(a∩b,c...) + @pure ⊇(a::T,b::S) where {T<:VectorSpace,S<:VectorSpace} = b ⊆ a @pure ⊆(::T,::Q) where {T<:VectorSpace{N,M,S},Q<:VectorSpace{N,M,S}} where {N,M,S} = true @pure ⊆(::T,::S) where {T<:VectorSpace{N},S<:VectorSpace{N}} where N = false