Skip to content

diagm doesn't work #25

Closed
Closed
@tkoolen

Description

@tkoolen
A = OffsetArray(rand(3), -3)
diagm(A)

results in

ERROR: size not supported for arrays with indices (-2:0,); see http://docs.julialang.org/en/latest/devdocs/offset-arrays/
Stacktrace:
 [1] errmsg(::OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}}) at /Users/twan/code/julia/MixedIntegerExperiments/v0.6/OffsetArrays/src/OffsetArrays.jl:48
 [2] diagm at ./linalg/dense.jl:250 [inlined] (repeats 2 times)

on nightly. This should probably be fixed in Base, but I wanted to get your input first.

As for the desired output type of diagm, I guess it should always be

typeof(similar(A, first(indices(A)), first(indices(A))))

?

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