Skip to content

Commit

Permalink
Make Base.show() output more petite
Browse files Browse the repository at this point in the history
  • Loading branch information
abhro authored Jun 15, 2024
1 parent a0b7026 commit 250d3ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/affine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ for any matrix-like object `M`.
struct LinearMap{M} <: AbstractAffineMap
linear::M
end
Base.show(io::IO, trans::LinearMap) = print(io, "LinearMap($(trans.linear))") # TODO make this output more petite
function Base.show(io::IO, trans::LinearMap)
print(io, "LinearMap(", trans.linear, ")")
end

function (trans::LinearMap{M})(x) where {M}
trans.linear * x
Expand Down Expand Up @@ -124,7 +126,9 @@ function AffineMap(trans::Transformation, x0)
AffineMap(dT, Tx - dT*x0)
end

Base.show(io::IO, trans::AffineMap) = print(io, "AffineMap($(trans.linear), $(trans.translation))") # TODO make this output more petite
function Base.show(io::IO, trans::AffineMap)
print(io, "AffineMap(", trans.linear, ", ", trans.translation, ")")
end

function compose(t1::Translation, t2::LinearMap)
AffineMap(t2.linear, t1.translation)
Expand Down

0 comments on commit 250d3ad

Please sign in to comment.