Question: Write a function inner _ product that takes as its input two vectors a and b , and returns as its output their inner product.
Write a function innerproduct that takes as its input two vectors a and and returns as its output their inner product.
Hint: It will be important to use the conj function to conjugate the appopriate element since a when is complex.
Note the use of the @assert macro to check if the vectors have the same length.
"Compute b a
function innerproducta: :AbstractVector, b: :AbstractVector
cassert length length
length
ip
for in : lengtha
ip b
end
return ip
end
Run
Verify Solution
x Code errored ms
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
