Skip to content

Commit

Permalink
show(::UnitRangeDual)
Browse files Browse the repository at this point in the history
  • Loading branch information
ogauthe committed Jun 14, 2024
1 parent d42c017 commit 45e8cc6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions NDTensors/src/lib/GradedAxes/src/unitrangedual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ Base.step(a::UnitRangeDual) = label_dual(step(nondual(a)))

Base.view(a::UnitRangeDual, index::Block{1}) = a[index]

function Base.show(io::IO, a::UnitRangeDual)
return print(io, UnitRangeDual, "(", blocklasts(a), ")")
end

function Base.show(io::IO, mimetype::MIME"text/plain", a::UnitRangeDual)
return Base.invoke(
show, Tuple{typeof(io),MIME"text/plain",AbstractArray}, io, mimetype, a
)
end

function Base.getindex(a::UnitRangeDual, indices::AbstractUnitRange{<:Integer})
return dual(getindex(nondual(a), indices))
end
Expand Down

0 comments on commit 45e8cc6

Please sign in to comment.