A=[1 2 3 4] B=[7 2 3 2] @show(A .* B) # Elementwise times is the "dot star" @show(A * B); # Matmul is just the "star" A = [ 2 -1 5 3 4 4 -4 -2 0] B = [ 1 0 -2 1 -5 1 -3 0 3] C = A * B B*A A*B - B*A A*(A^2 + 2*A + inv(A)*10) (A^2 + 2*A + inv(A)*10) * A A A[2,3] # 2nd row, 3rd col A[2,:] # 2nd row of A B B[:,1] # 1st column of B dot(A[2,:], B[:,1]) A[2,:] ⋅ B[:,1] # type \cdot + tab α = A[2,3] # \alpha + tab C[2,1] A[2,:]' * B[:,1] # yet another way to get a dot product function matmul_ijk(A,B) m,n = size(A) n2,p = size(B) if n≠n2 error("No good, n=$n ≠ n2=$(n2)") end C = fill(0,m,p) # m x p "zeros" matrix for i=1:m, j=1:p, k=1:n C[i,j] += A[i,k]*B[k,j] # shorthand for C[i,j] = C[i,j] + A[i,k]*B[k,j] end return C end matmul_ijk(A,B) A*B B[:,1] A * B[:,1] using Interact @manipulate for j=1:3 A * B[:,j] end [ A*B[:,1] A*B[:,2] A*B[:,3] ] A*B A A * [ -1 0 0 0 0 1 0 1 0 ] A * [ 0 1 0 1 0 0 0 0 1 ] A A[1,:] A A[1,:] * B A[1,:]' A[1,:]' * B C B * A[1,:]' [ A[1,:]'*B A[2,:]'*B A[3,:]'*B ] == C B [ 1 0 0 0 1 0 2 0 1 ] * B [ 1 0 0 -1 1 0 3 0 1 ] * B A[:,1] * B[1,:]' A[:,1] * B[1,:]' + A[:,2] * B[2,:]' + A[:,3] * B[3,:]' == C