Calculation with three dimensional matrices
8 次查看(过去 30 天)
显示 更早的评论
I want to calculate a vector
, with each element
defined as follows
, with each element
defined as follows
, where
is the set of N dimensional vector, and
is also the set of N dimensional vector, c is a constant. The superscript T is denoted as the transpose operation.In my matlab code,
is stored as a three dimensional matrix G, its dimension is
(where
).
is stored as a three dimensional matrix G, its dimension is
).
is also stored as a three dimensional matrix W, its dimension is
). c is a scalar.I know i can use multiple for loop to calculate this vector Y, but it is too inefficient. Is there any some fast way to calculate it, maybe use three-dimensional matrix calculation method?
采纳的回答
埃博拉酱
2025-1-22
function Y=cGW_Y(c,G,W)
Y=permute(pagemtimes(permute(G,[2,3,1]),permute(W,[3,2,1])),[4,3,2,1]);%1×K×I×J
Y=pagemtimes(Y,'none',Y,'ctranspose');%1×1×I×J
Y=log2(sum(Y./(sum(Y,3)+c*c-Y),4)+1);%1×1×I
end
更多回答(1 个)
Divyanshu
2025-1-21
You can try using 'pagetimes' function of MATLAB. For more details about 'pagetimes' refer the following documentation link:
Additionally, you can take reference from following MATLAB answer thread as well:
Hope it helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!