Vector, Row Column and Array

Hi all,

suppose the following code:

a = [2, 3, 4]
z = [5, 7, 9]

b = a .+ 1
c = (a .+ 1)'
d = a' .+ 1

s = (a' .+ 1) * z
t = (a .+ 1)' * z
u = b' * z
v = c * z
w = d * z

The last five lines all calculate the dot product. The value always is 88. But

  • s and w are of type Vector
  • t, u and v are scalars

I suppose that these different resulting types are intended. Is there an easy explanation for this behavior?
Espacially it was confusing for me, that the types of s and t differ. From the math point of view, they should not - or am I mistakening?

Thanks for explanation and best regards

Torsten

1 Like

I recommend JuliaCon 2017 | Taking Vector Transposes Seriously | Jiahao Chen - YouTube. Vectors and co-vectors are complicated.

4 Likes

thanks for that hint. Great talk!

Indeed vectors are kind of brain twisting, but if ones thinks through carefully, it works. In my case I managed to get code working for scalar arguments as well as for vectors. Several times ad had to transpose twice. Looks strange at first but is consequent.

1 Like