1x1 Matrix automatically converted to number

I would like

julia> [1; 0]' * [1 0; 0 2] * [1; 0]
1

to return a 1x1 Matrix. Is there a more convenient syntax than

julia> Matrix(transpose([1; 0])) * [1 0; 0 2] * [1; 0]
1-element Vector{Int64}:
 1

which still does not return a Matrix but a Vector.

Ref: Matrix multiplication with transpose · Issue #512 · JuliaPy/SymPy.jl · GitHub

julia> [1;; 0] * [1 0; 0 2] * [1; 0;;]
1×1 Matrix{Int64}:
 1

… and it is consistent. Thank you for the reply.

[1 0]*[1 0; 0 2]*[1;0;;]

works.
Be careful about the type of the input.
Julia doesn’t automatically convert a 1x1 matrix into a number but the type of the inputs in the multiplication was different.

2 Likes