Skip to content

Matrix factorizations with unitful elements fail #128

Closed
@jiahao

Description

@jiahao

A simple example:

julia> using SIUnits; A=randn(1,1)Second
1x1 Array{SIQuantity{Float64,m,kg,s,A,K,mol,cd},2}:
 -1.0710545530502584 s 

julia> lufact(A)
ERROR: `convert` has no method matching convert(::Type{Float64}, ::SIQuantity{Float64,0,0,1,0,0,0,0})
 in copy! at abstractarray.jl:149
 in convert at abstractarray.jl:303
 in lufact at linalg/lu.jl:65

The error arises here because lufact dispatches on this method which computes T=eltype(A); S=one(T)/one(T) and converts the matrix to an AbstractMatrix{S}. In this case S == Float64 drops the SIQuantity annotation, which causes the error.

cc: @Keno @andreasnoack

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions