# Error that I would like help reading- about creating matrices

**URL:** https://discourse.julialang.org/t/error-that-i-would-like-help-reading-about-creating-matrices/11451
**Category:** New to Julia
**Tags:** question
**Created:** [June 5, 2018, 6:41pm UTC](https://discourse.julialang.org/t/error-that-i-would-like-help-reading-about-creating-matrices/11451 "2018-06-05T18:41:52Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![CPPhysics](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cpphysics/32/4372_2.png) [@CPPhysics](https://discourse.julialang.org/u/CPPhysics)
#### Post date: [June 5, 2018, 6:41pm UTC](https://discourse.julialang.org/t/error-that-i-would-like-help-reading-about-creating-matrices/11451/1 "2018-06-05T18:41:53Z")

</div>

I have posted the error below, I am new to Julia and would take any suggestions on interpreting/fixing it:

MethodError: no method matching kron(::Array{JuMP.GenericAffExpr{Float64,JuMP.Variable},2}, ::UniformScaling{Int64})  
Closest candidates are:  
kron(::Any, ::Any, ::Any, ::Any…) at operators.jl:424  
kron(::Union{Array{T,1}, Array{T,2}} where T, ::SparseMatrixCSC) at sparse\linalg.jl:785  
kron(::AbstractArray{T,2}, ::AbstractArray{S,2}) where {T, S} at linalg\dense.jl:313

---

<div class="post-metadata">

### Author: ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)
#### Post date: [June 5, 2018, 6:56pm UTC](https://discourse.julialang.org/t/error-that-i-would-like-help-reading-about-creating-matrices/11451/2 "2018-06-05T18:56:37Z")

</div>

It would be helpful if you could also post your input.

I find `UniformScaling` slightly awkward to use in that it is not an `AbstractArray` (i.e. it doesn’t not always behave like an array), so it doesn’t always have methods defined for it).

Try

```julia
kron(x, Diagonal(ones(N)))

```

where `x` is your first argument and `N` is the number of dimensions in your second argument. This should work but is probably not the most efficient way of doing whatever it is you’re trying to achieve.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [June 6, 2018, 6:31am UTC](https://discourse.julialang.org/t/error-that-i-would-like-help-reading-about-creating-matrices/11451/3 "2018-06-06T06:31:11Z")

</div>

Also, please [quote your code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530).

---

<div class="post-metadata">

### Author: ![CPPhysics](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cpphysics/32/4372_2.png) [@CPPhysics](https://discourse.julialang.org/u/CPPhysics)
#### Post date: [June 6, 2018, 9:34pm UTC](https://discourse.julialang.org/t/error-that-i-would-like-help-reading-about-creating-matrices/11451/4 "2018-06-06T21:34:58Z")

</div>

Thank you! I may give more information when I can for better performance however your suggestion has worked in the meantime.
