From 032bde4d26075bca39bc484ef29235e921580240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Gauth=C3=A9?= Date: Thu, 31 Oct 2024 19:26:55 -0400 Subject: [PATCH] remove doublets --- .../src/lib/GradedAxes/src/gradedunitrange.jl | 5 ---- .../lib/GradedAxes/src/gradedunitrangedual.jl | 24 +------------------ 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl index 7738d975a9..d32155b46f 100644 --- a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl +++ b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl @@ -69,11 +69,6 @@ function space_isequal(a1::AbstractUnitRange, a2::AbstractUnitRange) return (isdual(a1) == isdual(a2)) && labelled_isequal(a1, a2) end -# TODO: See if this is needed. -function Base.AbstractUnitRange{T}(a::GradedOneTo{<:LabelledInteger{T}}) where {T} - return unlabel_blocks(a) -end - # TODO: Use `TypeParameterAccessors`. Base.eltype(::Type{<:GradedUnitRange{T}}) where {T} = T diff --git a/NDTensors/src/lib/GradedAxes/src/gradedunitrangedual.jl b/NDTensors/src/lib/GradedAxes/src/gradedunitrangedual.jl index c6d79495a5..def3dbfc75 100644 --- a/NDTensors/src/lib/GradedAxes/src/gradedunitrangedual.jl +++ b/NDTensors/src/lib/GradedAxes/src/gradedunitrangedual.jl @@ -17,16 +17,6 @@ Base.step(a::GradedUnitRangeDual) = label_dual(step(nondual(a))) Base.view(a::GradedUnitRangeDual, index::Block{1}) = a[index] -function Base.show(io::IO, a::GradedUnitRangeDual) - return print(io, GradedUnitRangeDual, "(", blocklasts(a), ")") -end - -function Base.show(io::IO, mimetype::MIME"text/plain", a::GradedUnitRangeDual) - return Base.invoke( - show, Tuple{typeof(io),MIME"text/plain",AbstractArray}, io, mimetype, a - ) -end - function Base.getindex(a::GradedUnitRangeDual, indices::AbstractUnitRange{<:Integer}) return dual(getindex(nondual(a), indices)) end @@ -88,10 +78,7 @@ function BlockArrays.BlockSlice(b::Block, r::GradedUnitRangeDual) return BlockSlice(b, dual(r)) end -using NDTensors.LabelledNumbers: LabelledNumbers, label -LabelledNumbers.label(a::GradedUnitRangeDual) = dual(label(nondual(a))) - -using NDTensors.LabelledNumbers: LabelledUnitRange +using NDTensors.LabelledNumbers: LabelledNumbers, LabelledUnitRange, label # The Base version of `length(::AbstractUnitRange)` drops the label. function Base.length(a::GradedUnitRangeDual{<:Any,<:LabelledUnitRange}) return dual(length(nondual(a))) @@ -131,15 +118,6 @@ function Base.OrdinalRange{Int,Int}( return unlabel(nondual(r)) end -# This is only needed in certain Julia versions below 1.10 -# (for example Julia 1.6). -# TODO: Delete this once we drop Julia 1.6 support. -# The type constraint `T<:Integer` is needed to avoid an ambiguity -# error with a conversion method in Base. -function Base.UnitRange{T}(a::GradedUnitRangeDual{<:LabelledInteger{T}}) where {T<:Integer} - return UnitRange{T}(nondual(a)) -end - function unlabel_blocks(a::GradedUnitRangeDual) return unlabel_blocks(nondual(a)) end