If u
and v
are a vector, you should write u.^2
and v.^2
instead (an element-wise operator). When you write u^2
means u * u
and it does not mean when u
is not a squared matrix.
However, if they are vector, it is not meant for computing the value of W
.