如何在core.matrix中明智地乘以矩阵和向量元素?在core.matrix中矩阵和向量的元素明智的乘法
我试图找到一个core.matrix相当于以下倍频代码:
A = [1 2 3 4; 5 6 7 8]
B = [2; 3]
A .* B
ans =
2 4 6 8
15 18 21 24
我的猜测是,下面的代码应该是等价的:
(let [A [[1 2 3 4]
[5 6 7 8]]
B [[2]
[3]]]
(* A B))
,但它所产生的以下错误:
RuntimeException: Incompatible shapes, cannot broadcast [2 1] to [2 4]
可能重复?这个问题是否有帮助 - http://stackoverflow.com/questions/19982466/matrix-multiplication-in-core-matrix - 我认为函数mmul应该这样做。 –