Problem 135. Inner product of two vectors
解决方案统计
Problem Comments
-
10 Comments
我认为,如果您指定向量是行向量,列向量,或者它们是否可以是任意混合物,那将是有帮助的。测试套件只有行矢量,但这使其变得琐碎。
If the x and y vectors could be row and column vectors, then bsxfun(@times, x, y) does a better job
测试集应包括一些列向量。
if you make the example-function "y = fcn(x,y)
z = x*y", please make sure matlab at least handles it; "z = fcn(x,y)
z = x*y" would be preferred =)
This function already exists, look up the dot function
In the given code snippet, make some changes to correct the function definition. (The first line)
Tricky on the variable to return... not sure if it was for teaching how-to-debug purposes.
funny, after all.
切记编辑返回变量(将其从y更改为z)
LOOK FOR 'y' IN-LINE 1
CHANGE IT TO 'z'!!!!!!!!!!
love it
解决方案评论
-
1条评论
tricky and conceptual
-
2条评论
Was confused for a second, probably because the operation isnt usually called the inner product
It *is* called Inner Product
-
1条评论
I didn't know what it meant by "inner product" and that's why I was confused.
-
1条评论
字面上只是按下一个键...
-
1条评论
简单的
-
2条评论
simple question
Good problem
-
1条评论
good problem
-
1条评论
我会澄清内部产品。我以前从未听说过它,并且不得不去Google。
-
1条评论
好的评论
-
1条评论
考虑到,解决完整的随机sudoku被评为介质,这应该很容易标记!
-
1条评论
尝试不同的方法,每次显示“断言失败”时,我的结果每次都是正确的。给我提示,以便我可以解决这个问题。
-
1条评论
A one-line code... Smart question :) had forgotten about this command.
-
1条评论
y =点(x,y)
-
1条评论
This example doesn't work, should be z = dot(x,y), or z = sum(x.*y)
-
1条评论
Please correct this problem. The output is y when it should be z_correct.
-
1条评论
is the problem is correct? do we take output y or z?
-
1条评论
LOL @y设置为输出。我差点相信this problem was invalid.
-
1条评论
change the output variable to be z
-
1条评论
I'm a bit confused. The code outputs the correct answers for the test suite, but it seems I do not pass while submitting.
-
1条评论
answer is in terms of z but function give answer in terms of y again confused and give error for simple problem
-
1条评论
那里不错的小错误。
-
1条评论
该用户(Mohamed Elbesealy)似乎已经为该系统提供了认可,并带有由'Sock-Puppet'帐户提交的这种不明显解决方案的欺诈性“赞”。- div
-
1条评论
This is correct. What am I missing?
-
1条评论
Eazy Eazy
-
3条评论
Why is this smaller than just x*y'?
不仅如此,他的输出是y而不是z!jajaj ...
That is the matrix attribute!
-
1条评论
i wrote solution like below
z = sum(x.*y);
它在我的笔记本电脑上工作,但在科迪显示不正确告诉我为什么
-
3条评论
嗯,描述有点令人困惑。长度(x)总是=长度(y)吗?它们是NX1还是1xn?无论如何,我提交了几个可能的解决方案(例如z = x'*y,z = sum金宝搏官方网站(x。*y))所有这些都使测试套件失败了...但是它们在我的机器上工作正常!
Note that the output variable in the pattern is y, not z.
ha, yeah. thanks for commenting about that. I didn't see it either.