diff --git a/docs/Project.toml b/docs/Project.toml index c27d111..81e3da9 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,3 +1,6 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" SparseMatricesCOO = "fa32481b-f100-4b48-8dc8-c62f61b13870" + +[compat] +Documenter = "1.0" diff --git a/docs/make.jl b/docs/make.jl index 1ebd31f..83bec6e 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -7,7 +7,6 @@ makedocs(; modules = [SparseMatricesCOO], doctest = true, linkcheck = false, - strict = true, authors = "Dominique Orban and contributors", repo = "https://github.com/JuliaSmoothOptimizers/SparseMatricesCOO.jl/blob/{commit}{path}#{line}", sitename = "SparseMatricesCOO.jl", diff --git a/src/coo_linalg.jl b/src/coo_linalg.jl index 84732a6..629e9a0 100644 --- a/src/coo_linalg.jl +++ b/src/coo_linalg.jl @@ -12,21 +12,30 @@ function coo_mul!(C::AbstractMatrix, Arows, Acols, Avals, B::AbstractMatrix, α, end end -function LinearAlgebra.mul!( - C::StridedVecOrMat, - A::AbstractSparseMatrixCOO, - B::SparseArrays.DenseInputVecOrMat, - α::Number, - β::Number, +for T in ( + AbstractVector, + AbstractMatrix, + Union{Bidiagonal, SymTridiagonal, Tridiagonal}, + Diagonal, + Transpose{<:Any, <:AbstractVecOrMat}, + Adjoint{<:Any, <:AbstractVecOrMat}, ) - size(A, 2) == size(B, 1) || throw(DimensionMismatch()) - size(A, 1) == size(C, 1) || throw(DimensionMismatch()) - size(B, 2) == size(C, 2) || throw(DimensionMismatch()) - if β != 1 - β != 0 ? rmul!(C, β) : fill!(C, zero(eltype(C))) + @eval function LinearAlgebra.mul!( + C::StridedVecOrMat, + A::AbstractSparseMatrixCOO, + B::$T, + α::Number, + β::Number, + ) + size(A, 2) == size(B, 1) || throw(DimensionMismatch()) + size(A, 1) == size(C, 1) || throw(DimensionMismatch()) + size(B, 2) == size(C, 2) || throw(DimensionMismatch()) + if β != 1 + β != 0 ? rmul!(C, β) : fill!(C, zero(eltype(C))) + end + coo_mul!(C, A.rows, A.cols, A.vals, B, α, nnz(A)) + C end - coo_mul!(C, A.rows, A.cols, A.vals, B, α, nnz(A)) - C end function coo_adjtrans_mul!(C::AbstractVector, Arows, Acols, Avals, B::AbstractVector, α, Annz, t) @@ -44,22 +53,31 @@ function coo_adjtrans_mul!(C::AbstractMatrix, Arows, Acols, Avals, B::AbstractMa end for (T, t) in ((Adjoint, adjoint), (Transpose, transpose)) - @eval function LinearAlgebra.mul!( - C::StridedVecOrMat, - xA::$T{<:Any, <:AbstractSparseMatrixCOO}, - B::SparseArrays.DenseInputVecOrMat, - α::Number, - β::Number, + for Tb in ( + AbstractVector, + AbstractMatrix, + Union{Bidiagonal, SymTridiagonal, Tridiagonal}, + Diagonal, + Transpose{<:Any, <:AbstractVecOrMat}, + Adjoint{<:Any, <:AbstractVecOrMat}, ) - A = xA.parent - size(A, 2) == size(C, 1) || throw(DimensionMismatch()) - size(A, 1) == size(B, 1) || throw(DimensionMismatch()) - size(B, 2) == size(C, 2) || throw(DimensionMismatch()) - if β != 1 - β != 0 ? rmul!(C, β) : fill!(C, zero(eltype(C))) + @eval function LinearAlgebra.mul!( + C::StridedVecOrMat, + xA::$T{<:Any, <:AbstractSparseMatrixCOO}, + B::$Tb, + α::Number, + β::Number, + ) + A = xA.parent + size(A, 2) == size(C, 1) || throw(DimensionMismatch()) + size(A, 1) == size(B, 1) || throw(DimensionMismatch()) + size(B, 2) == size(C, 2) || throw(DimensionMismatch()) + if β != 1 + β != 0 ? rmul!(C, β) : fill!(C, zero(eltype(C))) + end + coo_adjtrans_mul!(C, A.rows, A.cols, A.vals, B, α, nnz(A), $t) + C end - coo_adjtrans_mul!(C, A.rows, A.cols, A.vals, B, α, nnz(A), $t) - C end end @@ -86,22 +104,31 @@ function coo_sym_mul!(C::AbstractMatrix, Arows, Acols, Avals, B::AbstractMatrix, end for (T, t) in ((Hermitian, adjoint), (Symmetric, transpose)) - @eval function LinearAlgebra.mul!( - C::StridedVecOrMat, - xA::$T{<:Any, <:AbstractSparseMatrixCOO}, - B::SparseArrays.DenseInputVecOrMat, - α::Number, - β::Number, + for Tb in ( + AbstractVector, + AbstractMatrix, + Union{Bidiagonal, SymTridiagonal, Tridiagonal}, + Diagonal, + Transpose{<:Any, <:AbstractVecOrMat}, + Adjoint{<:Any, <:AbstractVecOrMat}, ) - A = xA.data - size(A, 2) == size(B, 1) || throw(DimensionMismatch()) - size(A, 1) == size(C, 1) || throw(DimensionMismatch()) - size(B, 2) == size(C, 2) || throw(DimensionMismatch()) - if β != 1 - β != 0 ? rmul!(C, β) : fill!(C, zero(eltype(C))) + @eval function LinearAlgebra.mul!( + C::StridedVecOrMat, + xA::$T{<:Any, <:AbstractSparseMatrixCOO}, + B::$Tb, + α::Number, + β::Number, + ) + A = xA.data + size(A, 2) == size(B, 1) || throw(DimensionMismatch()) + size(A, 1) == size(C, 1) || throw(DimensionMismatch()) + size(B, 2) == size(C, 2) || throw(DimensionMismatch()) + if β != 1 + β != 0 ? rmul!(C, β) : fill!(C, zero(eltype(C))) + end + coo_sym_mul!(C, A.rows, A.cols, A.vals, B, α, nnz(A), $t, xA.uplo) + C end - coo_sym_mul!(C, A.rows, A.cols, A.vals, B, α, nnz(A), $t, xA.uplo) - C end end