# Problem using kron in Convex

**URL:** https://discourse.julialang.org/t/problem-using-kron-in-convex/5657
**Category:** General Usage
**Created:** [August 31, 2017, 12:10pm UTC](https://discourse.julialang.org/t/problem-using-kron-in-convex/5657 "2017-08-31T12:10:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rocknokokoro](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@rocknokokoro](https://discourse.julialang.org/u/rocknokokoro)
#### Post date: [August 31, 2017, 12:10pm UTC](https://discourse.julialang.org/t/problem-using-kron-in-convex/5657/1 "2017-08-31T12:10:47Z")

</div>

Hello I am sort of a beginner with Julia so not sure if I am missusing Convex.

I am running a fresh install of Julia 0.52 and cloned the most recent version of Convex.

It appears that the object kron returns have different sizes depending on the order of the arguments.

Let me define two matrices:  
X = [0 0;0 0];  
Y = Variable(2,2);

If I investigate what kron does depending on the arguments I get the following:  
kron(X,Y)  
AbstractExpr with  
head: transpose  
size: (4, 4)  
sign: Convex.NoSign()  
vexity: Convex.AffineVexity()

kron(Y,X)  
AbstractExpr with  
head: transpose  
size: (2, 2)  
sign: Convex.NoSign()  
vexity: Convex.AffineVexity()

I care about this because I would like to take the trace of the resulting matrix multiplied with a third matrix Z:

Z = [0 0 0 0; 0 0 0 0; 0 0 0 0; 0 0 0 0];

Then depending on the order of kron, the multiplication is well defined or I get an error:

## Example OK:

trace(Z \* kron(X, Y));

## Example NOK:

trace(Z \* kron(Y, X));  
Cannot multiply two expressions of sizes (4,4) and (2,2)

in Convex.MultiplyAtom(::Convex.Constant, ::Convex.TransposeAtom) at /Users/localadmin/.julia/v0.5/Convex/src/atoms/affine/multiply\_divide.jl:29  
in \*(::Array{Int64,2}, ::Convex.TransposeAtom) at /Users/localadmin/.julia/v0.5/Convex/src/atoms/affine/multiply\_divide.jl:104  
in include\_string(::String, ::String) at ./loading.jl:441  
in include\_string(::String, ::String) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?

Is this a bug or I am missing something about how to use kron?
