在Matlab中如何做(m,n,k)*(n,k)=(m,k)? [英] How to do (m,n,k) * (n,k) = (m,k) in matlab?
本文介绍了在Matlab中如何做(m,n,k)*(n,k)=(m,k)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现了以下相关问题: 乘法列MatLab中具有3d矩阵的2d矩阵切片的矩阵的计算
I have found this relevant question: Multiply columns of a matrix with 2d matrix slices of a 3d matrix in MatLab
我有同样的问题,但在我的情况下,每个切片的m
可能有所不同.有没有一种方法可以使用
I have the same problem but in my case m
can vary for each slice. Is there a way to do that with mtimesx ? Because m
varies, my 3d tensor is stored as a list of cells, each containing a matrix. Also my 2d matrix is rather a list of cells each containing a vector.
有没有一种方法可以在没有for循环的情况下进行乘法运算?
Is there a way I can do this multiplication without a for loop?
推荐答案
Since your data is already stored in cellarrays, you can use cellfun
res = cellfun( @(x,y) x*y, mnkCell, nkCell, 'UniformOutput', false );
这篇关于在Matlab中如何做(m,n,k)*(n,k)=(m,k)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文