Problem using kron in Convex


#1

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?