diff --git a/Project.toml b/Project.toml index aa56f32..98fd09a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SuperLU" uuid = "149cae9a-b337-42bd-ac98-00096b14e8a3" authors = ["Kyungmin Lee "] -version = "0.1.0" +version = "0.1.1" [deps] CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" diff --git a/src/SuperLU.jl b/src/SuperLU.jl index 1ac500a..1a44bac 100644 --- a/src/SuperLU.jl +++ b/src/SuperLU.jl @@ -3,6 +3,13 @@ module SuperLU using SparseArrays using LinearAlgebra +const AdjointFact = isdefined(LinearAlgebra, :AdjointFactorization) ? + LinearAlgebra.AdjointFactorization : + Adjoint +const TransposeFact = isdefined(LinearAlgebra, :TransposeFactorization) ? + LinearAlgebra.TransposeFactorization : + Transpose + export splu include("libsuperlu_api.jl") diff --git a/src/linalg.jl b/src/linalg.jl index fa0ba43..323774f 100644 --- a/src/linalg.jl +++ b/src/linalg.jl @@ -4,18 +4,18 @@ function LinearAlgebra.ldiv!(a::LUDecomposition{Tv, SuperLUInt}, b::StridedVecOr return b end -function LinearAlgebra.ldiv!(a::Transpose{Tv, LUDecomposition{Tv, SuperLUInt}}, b::StridedVecOrMat{Tv}) where {Tv} +function LinearAlgebra.ldiv!(a::TransposeFact{Tv, LUDecomposition{Tv, SuperLUInt}}, b::StridedVecOrMat{Tv}) where {Tv} solve!(a.parent, b, TRANS) return b end -function LinearAlgebra.ldiv!(a::Adjoint{Tv, LUDecomposition{Tv, SuperLUInt}}, b::StridedVecOrMat{Tv}) where {Tv} +function LinearAlgebra.ldiv!(a::AdjointFact{Tv, LUDecomposition{Tv, SuperLUInt}}, b::StridedVecOrMat{Tv}) where {Tv} solve!(a.parent, b, CONJ) return b end # not sure why Julia only implements \ for NoTrans and Adjoint. -function Base.:(\)(tF::Transpose{Tv,LUDecomposition{Tv, Ti}}, B::AbstractVecOrMat) where {Tv, Ti} +function Base.:(\)(tF::TransposeFact{Tv,LUDecomposition{Tv, Ti}}, B::AbstractVecOrMat) where {Tv, Ti} Base.require_one_based_indexing(B) F = tF.parent TFB = typeof(oneunit(eltype(B)) / oneunit(eltype(F))) diff --git a/src/types.jl b/src/types.jl index f52bc63..ae06089 100644 --- a/src/types.jl +++ b/src/types.jl @@ -27,8 +27,10 @@ end Base.size(x::LUDecomposition) = (Int(x._L.nrow), Int(x._U.ncol)) Base.size(x::LUDecomposition, i::Integer) = size(x)[i] -Base.transpose(f::LUDecomposition) = Transpose(f) -Base.adjoint(f::LUDecomposition) = Adjoint(f) +Base.transpose(f::LUDecomposition) = TransposeFact(f) +if !isdefined(LinearAlgebra, :AdjointFactorization) # VERSION < v"1.10-" + Base.adjoint(f::LUDecomposition) = Adjoint(f) +end @inline function Base.getproperty(lu::LUDecomposition{Tv, Ti}, d::Symbol) where {Tv, Ti} if d == :L