Skip to content

Commit

Permalink
switched ϵ,∂ printing and improved ∪,∩
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Jun 15, 2019
1 parent bd8f82c commit f8e47df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/indices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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...)

Expand Down
6 changes: 6 additions & 0 deletions src/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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} = (ab,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}
Expand All @@ -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} = (ab,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
Expand Down

0 comments on commit f8e47df

Please sign in to comment.