diff --git a/Project.toml b/Project.toml index d7902aa6..f884a09f 100644 --- a/Project.toml +++ b/Project.toml @@ -7,7 +7,6 @@ version = "1.4.0" ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" [weakdeps] @@ -23,7 +22,6 @@ Accessors = "0.1" ArrayInterface = "7" DocStringExtensions = "0.8, 0.9" LinearAlgebra = "1.6" -MacroTools = "0.5" SparseArrays = "1.6" StaticArraysCore = "1" julia = "1.10" diff --git a/src/SciMLOperators.jl b/src/SciMLOperators.jl index 6eccd468..1e82b358 100644 --- a/src/SciMLOperators.jl +++ b/src/SciMLOperators.jl @@ -8,7 +8,7 @@ using DocStringExtensions using LinearAlgebra import ArrayInterface -import MacroTools: @forward +# MacroTools dependency removed - using explicit method forwarding instead import Accessors: @reset # overload diff --git a/src/basic.jl b/src/basic.jl index 057c2b01..af59c512 100644 --- a/src/basic.jl +++ b/src/basic.jl @@ -1001,16 +1001,16 @@ has_mul!(L::InvertedOperator) = has_ldiv!(L.L) has_ldiv(L::InvertedOperator) = has_mul(L.L) has_ldiv!(L::InvertedOperator) = has_mul!(L.L) -@forward InvertedOperator.L ( - # LinearAlgebra - LinearAlgebra.issymmetric, - LinearAlgebra.ishermitian, - LinearAlgebra.isposdef, - LinearAlgebra.opnorm, - - # SciML - isconstant, - has_adjoint) +# Method forwarding for InvertedOperator (previously using @forward from MacroTools) +# LinearAlgebra methods +LinearAlgebra.issymmetric(L::InvertedOperator) = LinearAlgebra.issymmetric(L.L) +LinearAlgebra.ishermitian(L::InvertedOperator) = LinearAlgebra.ishermitian(L.L) +LinearAlgebra.isposdef(L::InvertedOperator) = LinearAlgebra.isposdef(L.L) +LinearAlgebra.opnorm(L::InvertedOperator) = LinearAlgebra.opnorm(L.L) + +# SciML methods +isconstant(L::InvertedOperator) = isconstant(L.L) +has_adjoint(L::InvertedOperator) = has_adjoint(L.L) Base.:*(L::InvertedOperator, u::AbstractVecOrMat) = L.L \ u Base.:\(L::InvertedOperator, u::AbstractVecOrMat) = L.L * u diff --git a/src/left.jl b/src/left.jl index ef2fea45..dd81b2d9 100644 --- a/src/left.jl +++ b/src/left.jl @@ -106,19 +106,19 @@ for (op, LType, VType) in ((:adjoint, :AdjointOperator, :AbstractAdjointVecOrMat @eval getops(L::$LType) = (L.L,) - @eval @forward $LType.L ( - # LinearAlgebra - LinearAlgebra.issymmetric, - LinearAlgebra.ishermitian, - LinearAlgebra.isposdef, - LinearAlgebra.opnorm, - - # SciML - isconstant, - has_mul, - has_mul!, - has_ldiv, - has_ldiv!) + # Method forwarding (previously using @forward from MacroTools) + # LinearAlgebra methods + @eval LinearAlgebra.issymmetric(L::$LType) = LinearAlgebra.issymmetric(L.L) + @eval LinearAlgebra.ishermitian(L::$LType) = LinearAlgebra.ishermitian(L.L) + @eval LinearAlgebra.isposdef(L::$LType) = LinearAlgebra.isposdef(L.L) + @eval LinearAlgebra.opnorm(L::$LType) = LinearAlgebra.opnorm(L.L) + + # SciML methods + @eval isconstant(L::$LType) = isconstant(L.L) + @eval has_mul(L::$LType) = has_mul(L.L) + @eval has_mul!(L::$LType) = has_mul!(L.L) + @eval has_ldiv(L::$LType) = has_ldiv(L.L) + @eval has_ldiv!(L::$LType) = has_ldiv!(L.L) @eval function cache_internals(L::$LType, u::AbstractVecOrMat) @reset L.L = cache_operator(L.L, reshape(u, size(L, 1))) diff --git a/src/matrix.jl b/src/matrix.jl index eb4289cf..1e54a4a4 100644 --- a/src/matrix.jl +++ b/src/matrix.jl @@ -110,11 +110,13 @@ function Base.similar(L::MatrixOperator, ::Type{T}, dims::Dims) where {T} end # traits -@forward MatrixOperator.A (LinearAlgebra.issymmetric, - LinearAlgebra.ishermitian, - LinearAlgebra.isposdef, issquare, - has_ldiv, - has_ldiv!) +# Method forwarding for MatrixOperator (previously using @forward from MacroTools) +LinearAlgebra.issymmetric(L::MatrixOperator) = LinearAlgebra.issymmetric(L.A) +LinearAlgebra.ishermitian(L::MatrixOperator) = LinearAlgebra.ishermitian(L.A) +LinearAlgebra.isposdef(L::MatrixOperator) = LinearAlgebra.isposdef(L.A) +issquare(L::MatrixOperator) = issquare(L.A) +has_ldiv(L::MatrixOperator) = has_ldiv(L.A) +has_ldiv!(L::MatrixOperator) = has_ldiv!(L.A) isconvertible(::MatrixOperator) = true islinear(::MatrixOperator) = true @@ -408,17 +410,17 @@ getops(L::InvertibleOperator) = (L.L, L.F) islinear(L::InvertibleOperator) = islinear(L.L) isconvertible(L::InvertibleOperator) = isconvertible(L.L) -@forward InvertibleOperator.L ( - # LinearAlgebra - LinearAlgebra.issymmetric, - LinearAlgebra.ishermitian, - LinearAlgebra.isposdef, - - # SciML - isconstant, - has_adjoint, - has_mul, - has_mul!) +# Method forwarding for InvertibleOperator (previously using @forward from MacroTools) +# LinearAlgebra methods +LinearAlgebra.issymmetric(L::InvertibleOperator) = LinearAlgebra.issymmetric(L.L) +LinearAlgebra.ishermitian(L::InvertibleOperator) = LinearAlgebra.ishermitian(L.L) +LinearAlgebra.isposdef(L::InvertibleOperator) = LinearAlgebra.isposdef(L.L) + +# SciML methods +isconstant(L::InvertibleOperator) = isconstant(L.L) +has_adjoint(L::InvertibleOperator) = has_adjoint(L.L) +has_mul(L::InvertibleOperator) = has_mul(L.L) +has_mul!(L::InvertibleOperator) = has_mul!(L.L) has_ldiv(L::InvertibleOperator) = has_mul(L.F) has_ldiv!(L::InvertibleOperator) = has_ldiv!(L.F)