From c88bf3fae0b1a334647e2ba8202d11195bbe2718 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Wed, 22 Jan 2025 11:29:07 -0500 Subject: [PATCH 1/3] Backport a 1.10 implementation for `LinearAlgebra.diagind` --- src/wrappers.jl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/wrappers.jl b/src/wrappers.jl index e1644dd..483169a 100644 --- a/src/wrappers.jl +++ b/src/wrappers.jl @@ -164,8 +164,18 @@ end using LinearAlgebra: Diagonal @interface ::AbstractArrayInterface storedvalues(D::Diagonal) = LinearAlgebra.diag(D) + +# compat with LTS: +@static if VERSION ≥ v"1.11" + _diagind = LinearAlgebra.diagind +else + function _diagind(x::Diagonal, ::IndexCartesian) + return view(CartesianIndices(x), LinearAlgebra.diagind(x)) + end +end @interface ::AbstractArrayInterface eachstoredindex(D::Diagonal) = - LinearAlgebra.diagind(D, IndexCartesian()) + _diagind(D, IndexCartesian()) + @interface ::AbstractArrayInterface isstored(D::Diagonal, i::Int, j::Int) = i == j && Base.checkbounds(Bool, D, i, j) @interface ::AbstractArrayInterface function getstoredindex(D::Diagonal, i::Int, j::Int) From 095c843e7555c741b598db5da4ec500fd82b6a39 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Wed, 22 Jan 2025 11:29:56 -0500 Subject: [PATCH 2/3] Bump v0.2.10 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 8a19c36..79156fd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SparseArraysBase" uuid = "0d5efcca-f356-4864-8770-e1ed8d78f208" authors = ["ITensor developers and contributors"] -version = "0.2.9" +version = "0.2.10" [deps] Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" From 02ba823ff9b7970fbe129bcd140444832c877010 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Wed, 22 Jan 2025 11:37:36 -0500 Subject: [PATCH 3/3] Add missing import --- src/wrappers.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wrappers.jl b/src/wrappers.jl index 483169a..bf4fc78 100644 --- a/src/wrappers.jl +++ b/src/wrappers.jl @@ -162,7 +162,7 @@ for type in (:Adjoint, :PermutedDimsArray, :ReshapedArray, :SubArray, :Transpose end end -using LinearAlgebra: Diagonal +using LinearAlgebra: LinearAlgebra, Diagonal @interface ::AbstractArrayInterface storedvalues(D::Diagonal) = LinearAlgebra.diag(D) # compat with LTS: