Closed b-r-hamilton closed 1 year ago
works fine for quantities like Kelvin
julia> mat = UnitfulMatrix(ones(2,2).*u"K")
2×2 UnitfulMatrix{Float64,2}
1.0 K 1.0 K
1.0 K 1.0 K
julia> diag(mat)
2-element Vector{Quantity}:
1.0 K
1.0 K
made 2 fixes, full accounting in comment for PR #80
please check that it works for you
julia> using Unitful, UnitfulLinearAlgebra, LinearAlgebra
julia> permil = Unitful.FixedUnits(u"permille")
‰
julia> K = u"K"
K
julia> mat = UnitfulMatrix(ones(2,2)*permil*K)
2×2 UnitfulMatrix{Float64,2}
1.0 K ‰ 1.0 K ‰
1.0 K ‰ 1.0 K ‰
julia> diag(mat)
2-element Vector{Quantity}:
1.0 K ‰
1.0 K ‰
MWE