Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include outer brackets in pretty printing #238

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/tangent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
end

function Base.show(io::IO, x::ExplicitTangentBundle)
print(io, "(")

Check warning on line 217 in src/tangent.jl

View check run for this annotation

Codecov / codecov/patch

src/tangent.jl#L217

Added line #L217 was not covered by tests
print(io, x.primal)
print(io, " + ")
x = x.tangent
Expand All @@ -224,6 +225,7 @@
length(x.partials) >= 5 && print(io, " + ", x.partials[5], " ∂₁ ∂₃")
length(x.partials) >= 6 && print(io, " + ", x.partials[6], " ∂₂ ∂₃")
length(x.partials) >= 7 && print(io, " + ", x.partials[7], " ∂₁ ∂₂ ∂₃")
print(io, ")")

Check warning on line 228 in src/tangent.jl

View check run for this annotation

Codecov / codecov/patch

src/tangent.jl#L228

Added line #L228 was not covered by tests
end


Expand All @@ -250,12 +252,8 @@
@ChainRulesCore.non_differentiable check_taylor_invariants(coeffs, primal, N)


function Base.show(io::IO, x::TaylorBundle{1})
print(io, x.primal)
print(io, " + ")
x = x.tangent
print(io, x.coeffs[1], " ∂₁")
end
Base.show(io::IO, x::TaylorBundle{1}) = print(io, "($(x.primal) + $(only(x.tangent.coeffs)) ∂₁)")

Check warning on line 255 in src/tangent.jl

View check run for this annotation

Codecov / codecov/patch

src/tangent.jl#L255

Added line #L255 was not covered by tests


"for a TaylorTangent{N, <:Tuple} this breaks it up unto 1 TaylorTangent{N} for each element of the primal tuple"
function destructure(r::TaylorBundle{N, B}) where {N, B<:Tuple}
Expand Down
Loading