diff --git a/src/blas.jl b/src/blas.jl index a8ce39ef..d5d90a5c 100644 --- a/src/blas.jl +++ b/src/blas.jl @@ -84,8 +84,7 @@ export trsm!, trsm -using ..LinearAlgebra: libblastrampoline, BlasReal, BlasComplex, BlasFloat, BlasInt, - DimensionMismatch, checksquare, chkstride1, SingularException +using ..LinearAlgebra: libblastrampoline, BlasReal, BlasComplex, BlasFloat, BlasInt, DimensionMismatch, checksquare, chkstride1 include("lbt.jl") @@ -1378,11 +1377,6 @@ for (fname, elty) in ((:dtrsv_,:Float64), throw(DimensionMismatch(lazy"size of A is $n != length(x) = $(length(x))")) end chkstride1(A) - if diag == 'N' - for i in 1:n - iszero(A[i,i]) && throw(SingularException(i)) - end - end px, stx = vec_pointer_stride(x, ArgumentError("input vector with 0 stride is not allowed")) GC.@preserve x ccall((@blasfunc($fname), libblastrampoline), Cvoid, (Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, @@ -2231,11 +2225,6 @@ for (mmname, smname, elty) in end chkstride1(A) chkstride1(B) - if diag == 'N' - for i in 1:k - iszero(A[i,i]) && throw(SingularException(i)) - end - end ccall((@blasfunc($smname), libblastrampoline), Cvoid, (Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{BlasInt}, Ref{BlasInt}, Ref{$elty}, Ptr{$elty}, diff --git a/src/triangular.jl b/src/triangular.jl index 65070aa7..199ff119 100644 --- a/src/triangular.jl +++ b/src/triangular.jl @@ -1223,13 +1223,11 @@ function generic_mattrimul!(C::StridedMatrix{T}, uploc, isunitc, tfun::Function, end end # division -generic_trimatdiv!(C::StridedVector{T}, uploc, isunitc, tfun::Function, A::StridedMatrix{T}, B::AbstractVector{T}) where {T<:BlasFloat} = - BLAS.trsv!(uploc, tfun === identity ? 'N' : tfun === transpose ? 'T' : 'C', isunitc, A, C === B ? C : copyto!(C, B)) -function generic_trimatdiv!(C::StridedMatrix{T}, uploc, isunitc, tfun::Function, A::StridedMatrix{T}, B::AbstractMatrix{T}) where {T<:BlasFloat} +function generic_trimatdiv!(C::StridedVecOrMat{T}, uploc, isunitc, tfun::Function, A::StridedMatrix{T}, B::AbstractVecOrMat{T}) where {T<:BlasFloat} if stride(C,1) == stride(A,1) == 1 - BLAS.trsm!('L', uploc, tfun === identity ? 'N' : tfun === transpose ? 'T' : 'C', isunitc, one(T), A, C === B ? C : copyto!(C, B)) + LAPACK.trtrs!(uploc, tfun === identity ? 'N' : tfun === transpose ? 'T' : 'C', isunitc, A, C === B ? C : copyto!(C, B)) else # incompatible with LAPACK - @invoke generic_trimatdiv!(C::AbstractVecOrMat, uploc, isunitc, tfun::Function, A::AbstractMatrix, B::AbstractMatrix) + @invoke generic_trimatdiv!(C::AbstractVecOrMat, uploc, isunitc, tfun::Function, A::AbstractMatrix, B::AbstractVecOrMat) end end function generic_mattridiv!(C::StridedMatrix{T}, uploc, isunitc, tfun::Function, A::AbstractMatrix{T}, B::StridedMatrix{T}) where {T<:BlasFloat} diff --git a/test/testtriag.jl b/test/testtriag.jl index 6ed7a0d6..7542d843 100644 --- a/test/testtriag.jl +++ b/test/testtriag.jl @@ -493,8 +493,6 @@ function test_triangular(elty1_types) @test_throws DimensionMismatch transpose(Ann) \ bm if t1 == UpperTriangular || t1 == LowerTriangular @test_throws SingularException ldiv!(t1(zeros(elty1, n, n)), fill(eltyB(1), n)) - @test_throws SingularException ldiv!(t1(zeros(elty1, n, n)), fill(eltyB(1), n, 2)) - @test_throws SingularException rdiv!(fill(eltyB(1), n, n), t1(zeros(elty1, n, n))) end @test B / A1 ≈ B / M1 @test B / transpose(A1) ≈ B / transpose(M1) diff --git a/test/triangular.jl b/test/triangular.jl index eb6814b9..739c3ff3 100644 --- a/test/triangular.jl +++ b/test/triangular.jl @@ -891,13 +891,8 @@ end end end -@testset "(l/r)mul! and (l/r)div! for non-contiguous arrays" begin +@testset "(l/r)mul! and (l/r)div! for non-contiguous matrices" begin U = UpperTriangular(reshape(collect(3:27.0),5,5)) - b = float.(1:10) - b2 = copy(b); b2v = view(b2, 1:2:9); b2vc = copy(b2v) - @test lmul!(U, b2v) == lmul!(U, b2vc) - b2 = copy(b); b2v = view(b2, 1:2:9); b2vc = copy(b2v) - @test ldiv!(U, b2v) ≈ ldiv!(U, b2vc) B = float.(collect(reshape(1:100, 10,10))) B2 = copy(B); B2v = view(B2, 1:2:9, 1:5); B2vc = copy(B2v) @test lmul!(U, B2v) == lmul!(U, B2vc)