From 083b79ad753bc6cc2a4c860c7716f923e56a2d89 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 26 Apr 2023 10:52:10 +0200 Subject: [PATCH 1/2] simple arrayinterface overloads --- Project.toml | 2 ++ src/math.jl | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/Project.toml b/Project.toml index 3b10108..d3c0c46 100644 --- a/Project.toml +++ b/Project.toml @@ -4,6 +4,7 @@ authors = ["Chris Rackauckas "] version = "1.10.0" [deps] +ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" @@ -17,6 +18,7 @@ StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0" TreeViews = "a2a6695c-b41b-5b7d-aed9-dbfdeacea5d7" [compat] +ArrayInterface = "7" DiffEqBase = "6.5" FiniteDiff = "2.3" ForwardDiff = "0.10" diff --git a/src/math.jl b/src/math.jl index fdc7dea..6512369 100644 --- a/src/math.jl +++ b/src/math.jl @@ -94,6 +94,16 @@ function common_number(a, b) throw(DimensionMismatch("number of nodes must be equal")))) end +## ArrayInterface + +function ArrayInterface.zeromatrix(b::AMSA) + zero(eltype(b), length(b), length(b)) +end + +function ArrayInterface.undefmatrix(b::AMSA) + Array{eltype(b)}(undef, length(b), length(b)) +end + ## Linear Algebra function LinearAlgebra.ldiv!(A::LinearAlgebra.LU, b::AMSA) From 9bdd9ba8e00215de281477f96527f78a626c0d67 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Wed, 26 Apr 2023 12:03:34 +0200 Subject: [PATCH 2/2] import ArrayInterface --- src/MultiScaleArrays.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MultiScaleArrays.jl b/src/MultiScaleArrays.jl index 6480899..88ee0f3 100644 --- a/src/MultiScaleArrays.jl +++ b/src/MultiScaleArrays.jl @@ -7,7 +7,7 @@ import Base: length, push!, deleteat!, getindex, setindex!, eachindex, ndims, ==, *, +, /, -, show, vec, reshape import RecursiveArrayTools: recursivecopy, recursivecopy! - +import ArrayInterface import RecursiveArrayTools: chain """