From 20009e148e3fcc36902688807ff2b5841c790ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Gauth=C3=A9?= Date: Tue, 5 Nov 2024 12:00:08 -0500 Subject: [PATCH] use BlockLasts as argument name --- .../BlockSparseArraysGradedAxesExt/test/runtests.jl | 4 ++-- NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl | 11 ++++++----- .../src/lib/GradedAxes/src/gradedunitrangedual.jl | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/NDTensors/src/lib/BlockSparseArrays/ext/BlockSparseArraysGradedAxesExt/test/runtests.jl b/NDTensors/src/lib/BlockSparseArrays/ext/BlockSparseArraysGradedAxesExt/test/runtests.jl index 67cf96de00..585dbb5afe 100644 --- a/NDTensors/src/lib/BlockSparseArrays/ext/BlockSparseArraysGradedAxesExt/test/runtests.jl +++ b/NDTensors/src/lib/BlockSparseArrays/ext/BlockSparseArraysGradedAxesExt/test/runtests.jl @@ -141,8 +141,8 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64}) end @test axes(a') == dual.(reverse(axes(a))) - @test isdual(axes(a', 1)) ⊻ isdual(axes(a, 2)) - @test isdual(axes(a', 2)) ⊻ isdual(axes(a, 1)) + @test isdual(axes(a', 1)) ≠ isdual(axes(a, 2)) + @test isdual(axes(a', 2)) ≠ isdual(axes(a, 1)) @test isnothing(show(devnull, MIME("text/plain"), a)) # Check preserving dual in tensor algebra. diff --git a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl index 036efd9c0f..0bd35707a7 100644 --- a/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl +++ b/NDTensors/src/lib/GradedAxes/src/gradedunitrange.jl @@ -31,7 +31,8 @@ using ..LabelledNumbers: labelled_isequal, unlabel -abstract type AbstractGradedUnitRange{T,CS} <: AbstractBlockedUnitRange{T,CS} end +abstract type AbstractGradedUnitRange{T,BlockLasts} <: + AbstractBlockedUnitRange{T,BlockLasts} end struct GradedUnitRange{T,BlockLasts<:Vector{T}} <: AbstractGradedUnitRange{T,BlockLasts} first::T @@ -42,14 +43,14 @@ struct GradedOneTo{T,BlockLasts<:Vector{T}} <: AbstractGradedUnitRange{T,BlockLa lasts::BlockLasts # assume that lasts is sorted, no checks carried out here - function GradedOneTo(lasts::CS) where {T<:Integer,CS<:AbstractVector{T}} + function GradedOneTo(lasts::BlockLasts) where {T<:Integer,BlockLasts<:AbstractVector{T}} Base.require_one_based_indexing(lasts) isempty(lasts) || first(lasts) >= 0 || throw(ArgumentError("blocklasts must be >= 0")) - return new{T,CS}(lasts) + return new{T,BlockLasts}(lasts) end - function GradedOneTo(lasts::CS) where {T<:Integer,CS<:Tuple{T,Vararg{T}}} + function GradedOneTo(lasts::BlockLasts) where {T<:Integer,BlockLasts<:Tuple{T,Vararg{T}}} first(lasts) >= 0 || throw(ArgumentError("blocklasts must be >= 0")) - return new{T,CS}(lasts) + return new{T,BlockLasts}(lasts) end end diff --git a/NDTensors/src/lib/GradedAxes/src/gradedunitrangedual.jl b/NDTensors/src/lib/GradedAxes/src/gradedunitrangedual.jl index b5d85b9e97..217d4b401f 100644 --- a/NDTensors/src/lib/GradedAxes/src/gradedunitrangedual.jl +++ b/NDTensors/src/lib/GradedAxes/src/gradedunitrangedual.jl @@ -1,5 +1,6 @@ -struct GradedUnitRangeDual{T,CS,NondualUnitRange<:AbstractGradedUnitRange{T,CS}} <: - AbstractGradedUnitRange{T,CS} +struct GradedUnitRangeDual{ + T,BlockLasts,NondualUnitRange<:AbstractGradedUnitRange{T,BlockLasts} +} <: AbstractGradedUnitRange{T,BlockLasts} nondual_unitrange::NondualUnitRange end