Skip to content

Matrix inverse is broken #737

Closed
Closed
@Technici4n

Description

@Technici4n

ForwardDiff: v0.10.38
Julia: v1.11.3

julia> function f(ε)
            A = [1 ε; 2ε 2]
            inv(A) * A
       end
f (generic function with 1 method)

julia> ForwardDiff.derivative(f, 0)
2×2 Matrix{Float64}:
 0.0  0.0
 1.0  0.0

inv(A) * A is an identity, so its derivative should be 0.

On my Julia version, what is happening is that the inv version will see that istriu(A) evaluates to true and pick an optimized path for that - completely ignoring the dual components on the lower diagonal part.

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