Log In  


I was trying to compute the outer product of a column vector x with itself, like so:

xxt=x:matmul(x:transpose())

The resulting matrix had the right shape, but the only nonzero entries were on the diagonal. If I explicitly create a row vector and copy, then I get the correct result.



It seems like transposition fails on non-square matrices. Like it's trying to read the old x,y positions, and just getting 0, because the new matrix doesn't have anything at those positions.
If you want to transpose a 1d vector, thankfully there's an easy workaround.

local x_transposed = userdata("f64",x:height(),x:width()):copy(x,true)


[Please log in to post a comment]