Skip to content

Add Matrix(I, n, m) method #468

@andyferris

Description

@andyferris

In Julia v0.7 you don't need to specify the eltype of the matrix - it is inferred from the UniformScaling{T} input. Compat has only defined the Matrix{T}(::UniformScaling, n, m) method.

# Julia v0.6.2
julia> using Compat

julia> Matrix(I, 4, 4)
ERROR: MethodError: no method matching Array{T,2} where T(::UniformScaling{Int64}, ::Int64, ::Int64)
Closest candidates are:
  Array{T,2} where T(::Compat.Uninitialized, ::Any...) at string:5
  Array{T,2} where T(::Integer, ::Integer) at sysimg.jl:105

julia> Matrix{Float64}(I, 4, 4)
4×4 Array{Float64,2}:
 1.0  0.0  0.0  0.0
 0.0  1.0  0.0  0.0
 0.0  0.0  1.0  0.0
 0.0  0.0  0.0  1.0

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