What is the best way to get a number out of an inner product operation, rather than a 1x1 array. Is there a better way than this:
([1 2 3]*[4 5 6]')[1]
What is the best way to get a number out of an inner product operation, rather than a 1x1 array. Is there a better way than this:
([1 2 3]*[4 5 6]')[1]
If possible, I wouldn't do the inner product manually, I'd use
dot
, i.e.I've noticed that you don't actually have vectors there though, instead you have
1x3
matrices (rows), so if thats really what you have you'd have tovec
them first, which is a bit unpleasant:Alternatively, one could do
which doesn't care about the dimensions.