Skip to content

cond function fails for non-square matrices #1862

@stevengj

Description

@stevengj

Currently, linalg.jl defines cond(a::AbstractMatrix) = cond(a, 2). This only works for square matrices. The correct definition (as well as being more efficient) is:

cond(a::AbstractMatrix) = let s = svdvals(a); max(s) / min(s); end

And cond(a,2) should also do this, of course.

Note also that cond(a,p) fails with an exception (Singular system) if a is singular, whereas it should really give Inf in that case (or NaN if a is all zeros).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions