Skip to content

performance of \(::UpperOrLowerTriangular{Float64}, ::Matrix{ComplexF64}) regression since v1.10 #61258

@songjhaha

Description

@songjhaha

MWE:

using Random
using LinearAlgebra
Random.seed!(1234)
G = rand(2000, 2000);
Q = rand(2000, 2000);
Z = G + im * Q;
function f(A, b)
    
    F = lu(A; check=false)

    L, U, P = F
    y = L \ (b[P, :])
    return U \ y
end

@time f(G, Z);

In Julia 1.10

julia> @time f(G, Z);
  8.785467 seconds (13.07 k allocations: 275.582 MiB, 0.35% gc time, 0.25% compilation time)

In Julia 1.9

julia> @time f(G, Z);
  0.711327 seconds (18 allocations: 396.760 MiB, 1.92% gc time)

tracking to this fallback implement:

function generic_trimatdiv!(C::AbstractVecOrMat, uploc, isunitc, tfun::Function, A::AbstractMatrix, B::AbstractVecOrMat)

the LAPACK routine is not hit because eltype(C) !== eltype(A)

generic_trimatdiv!(C::StridedVecOrMat{T}, uploc, isunitc, tfun::Function, A::StridedMatrix{T}, B::AbstractVecOrMat{T}) where {T<:BlasFloat} =

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions