From e5274938f4e5d42e904b000b64790ef84d69da13 Mon Sep 17 00:00:00 2001 From: Tianyi Pu <912396513@qq.com> Date: Thu, 14 Mar 2024 09:07:46 +0000 Subject: [PATCH 1/2] use EltypeExtensions: elconvert --- Project.toml | 4 +++- src/LazyArrays.jl | 2 ++ src/lazybroadcasting.jl | 4 +--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index a3a6581b..9108d42b 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,7 @@ version = "1.8.3" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" +EltypeExtensions = "583f92f5-06d6-4306-8236-316410defc98" FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" @@ -21,9 +22,10 @@ LazyArraysStaticArraysExt = "StaticArrays" Aqua = "0.8" ArrayLayouts = "1.4.1" Base64 = "1" +EltypeExtensions = "0.0.2, 0.0.3" FillArrays = "1.0" -LinearAlgebra = "1" Infinities = "0.1" +LinearAlgebra = "1" MacroTools = "0.5" MatrixFactorizations = "1.0, 2.0" SparseArrays = "1" diff --git a/src/LazyArrays.jl b/src/LazyArrays.jl index 9521c9fa..4798dfb7 100644 --- a/src/LazyArrays.jl +++ b/src/LazyArrays.jl @@ -63,6 +63,8 @@ import ArrayLayouts: MatMulVecAdd, MatMulMatAdd, MulAdd, Lmul, Rmul, Ldiv, Dot, import Base: require_one_based_indexing, oneto +import EltypeExtensions: elconvert + export Mul, Applied, MulArray, MulVector, MulMatrix, InvMatrix, PInvMatrix, Hcat, Vcat, Kron, BroadcastArray, BroadcastMatrix, BroadcastVector, cache, Ldiv, Inv, PInv, Diff, Cumsum, Accumulate, applied, materialize, materialize!, ApplyArray, ApplyMatrix, ApplyVector, apply, @~, LazyArray, diff --git a/src/lazybroadcasting.jl b/src/lazybroadcasting.jl index 238b6ed2..921bd9ae 100644 --- a/src/lazybroadcasting.jl +++ b/src/lazybroadcasting.jl @@ -89,9 +89,7 @@ size(A::BroadcastArray) = map(length, axes(A)) @propagate_inbounds getindex(A::BroadcastArray{T,N}, kj::Vararg{Int,N}) where {T,N} = convert(T,broadcasted(A)[kj...])::T -converteltype(::Type{T}, A::AbstractArray) where T = convert(AbstractArray{T}, A) -converteltype(::Type{T}, A) where T = convert(T, A) -sub_materialize(::BroadcastLayout, A) = converteltype(eltype(A), materialize(_broadcasted(A))) +sub_materialize(::BroadcastLayout, A) = elconvert(eltype(A), materialize(_broadcasted(A))) copy(bc::Broadcasted{<:LazyArrayStyle}) = BroadcastArray(bc) From 223e9a0f8454fabfa0244ab302a6419b6e00ea7c Mon Sep 17 00:00:00 2001 From: Tianyi Pu <912396513@qq.com> Date: Fri, 15 Mar 2024 08:25:41 +0000 Subject: [PATCH 2/2] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 9108d42b..2ae356d5 100644 --- a/Project.toml +++ b/Project.toml @@ -22,7 +22,7 @@ LazyArraysStaticArraysExt = "StaticArrays" Aqua = "0.8" ArrayLayouts = "1.4.1" Base64 = "1" -EltypeExtensions = "0.0.2, 0.0.3" +EltypeExtensions = "0.0.4" FillArrays = "1.0" Infinities = "0.1" LinearAlgebra = "1"