Skip to content

Commit dc32b2f

Browse files
committed
refactored show/print methods
1 parent bf5ad18 commit dc32b2f

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DirectSum"
22
uuid = "22fd7b30-a8c0-5bf2-aabe-97783860d07c"
33
authors = ["Michael Reed"]
4-
version = "0.7.7"
4+
version = "0.7.8"
55

66
[deps]
77
ComputedFieldTypes = "459fdd68-db75-56b8-8c15-d717a790f88e"
@@ -12,7 +12,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1212

1313
[compat]
1414
julia = "1"
15-
Leibniz = "0.1"
15+
Leibniz = "0.1.6"
1616
AbstractTensors = "0.6"
1717
ComputedFieldTypes = "0.1"
1818

src/DirectSum.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ end
250250
@inline interform(a::A,b::B) where {A<:SubManifold{V},B<:SubManifold{V}} where V = a(b)
251251

252252
function Base.show(io::IO,s::SubManifold{V,NN,S}) where {V,NN,S}
253-
isbasis(s) && (return printindices(io,V,bits(s)))
253+
isbasis(s) && (return printindices(io,V,UInt(s)))
254254
P = typeof(V)<:Int ? V : parent(V)
255255
PnV = typeof(P) typeof(V)
256256
PnV && print(io,'Λ',sups[rank(V)])
@@ -366,8 +366,8 @@ Simplex type with pseudoscalar `V::Manifold`, grade/rank `G::Int`, `B::SubManifo
366366
"""
367367
struct Simplex{V,G,B,T} <: TensorTerm{V,G}
368368
v::T
369-
Simplex{A,B,C,D}(t::E) where E<:D where {A,B,C,D} = new{submanifold(A),B,C,D}(t)
370-
Simplex{A,B,C,D}(t::E) where E<:TensorAlgebra{A} where {A,B,C,D} = new{submanifold(A),B,C,D}(t)
369+
Simplex{A,B,C,D}(t::E) where E<:D where {A,B,C,D} = new{submanifold(A),B,basis(C),D}(t)
370+
Simplex{A,B,C,D}(t::E) where E<:TensorAlgebra{A} where {A,B,C,D} = new{submanifold(A),B,basis(C),D}(t)
371371
end
372372

373373
export Simplex
@@ -392,12 +392,7 @@ end
392392
function Simplex{V,G,B}(b::T) where T<:TensorTerm{V} where {V,G,B}
393393
order(B)+order(b)>diffmode(V) ? zero(V) : Simplex{V,G,B,Any}(b)
394394
end
395-
function Base.show(io::IO,m::Simplex)
396-
T = typeof(value(m))
397-
par = !(T <: TensorTerm) && |(broadcast(<:,T,parval)...)
398-
#val = T<:Float64 ? @fprintf() : m.v
399-
print(io,(par ? ['(',m.v,')'] : [m.v])...,basis(m))
400-
end
395+
Base.show(io::IO,m::Simplex) = Leibniz.showvalue(io,Manifold(m),UInt(basis(m)),value(m))
401396
for VG ((:V,),(:V,:G))
402397
@eval function Simplex{$(VG...)}(v,b::Simplex{V,G}) where {V,G}
403398
order(v)+order(b)>diffmode(V) ? zero(V) : Simplex{V,G,basis(b)}(AbstractTensors.(v,b.v))

0 commit comments

Comments
 (0)