New identity matrix constructor (0.7) in 0.6

I noticed some rather strange behavior running julia 0.6.2. On a ‘fresh’ instance of julia without any packages,

Matrix(1.0I, 3, 3)

does not work. However, as soon as I load the BenchmarkTools package, the identity matrix is returned as it would be expected in julia 0.7.

Skimming the source code of BenchmarkTools I did not find a new constructor for the Matrix type…

Does anyone know what is going on?

I think that BenchmarkTools.jl loads Compat.jl, which defines the relevant method. Try

@edit Matrix(1.0I, 3, 3)
3 Likes

Thank you for your fast reply! That’s it.