Should transpose of a Vector be a Matrix?

As Julia has a true 1D vector data type, shouldn’t the transpose of a Vector just be a Vector (essentially an identity operation)? See Conor Hoekstra’s comments in APL vs BQN vs J vs Q vs NumPy vs Julia vs R - YouTube

I assume this stems from MATLAB where a vector is actually a 2D array and that you can, of course, transpose.

What are your thoughts about this?

It matters if you do a matrix vector multiplication from the left A * x or the right x' *A. A vec in Julia is a column vector, so it makes no sense to multiply it by a matrix from the left. So x * A is wrong. If you try it you will get a DimensionMismatch: error.

I highly reccomend JuliaCon 2017 | Taking Vector Transposes Seriously | Jiahao Chen - YouTube and Taking vector transposes seriously · Issue #4774 · JuliaLang/julia · GitHub. There has been a lot of thought put into this, and it’s a very complicated issue.

5 Likes

In particular v'*v should produce a scalar while v*v' should be an n x n matrix. That cannot work if v' is just v since they both reduce to v*v in that case.

6 Likes