Reshaping Arrays (DimensionMismatch)

Hi - I have the following arrays:
X = Shape (50562,19)
theta = Shape (19,)

im trying to do a simple dot product but i get the following error:
DimensionMismatch(“first array has length 960678 which does not match the length of the second, 19.”)

Any suggestions?

I think you’re looking for * not dot, different languages differ a bit in how they handle various combinations of matrices & vectors.

julia> X = rand(50562,19); θ = rand(19);

julia> dot(θ,θ)
5.91416099980499

julia> dot(X,θ)
ERROR: DimensionMismatch("dot product arguments have lengths 960678 and 19")

julia> size(X * θ)
(50562,)

julia> θ * θ
ERROR: MethodError: no method matching *(::Array{Float64,1}, ::Array{Float64,1})

julia> θ' * θ
5.91416099980499

julia> size(θ')
(1, 19)
2 Likes