フィルターのクリア

Tensor creation like "pageTensorprod"?

2 ビュー (過去 30 日間)
Adrien Leygue
Adrien Leygue 2023 年 3 月 23 日
コメント済み: Adrien Leygue 2023 年 3 月 24 日
I have two 3x3xN tensors (let's call them A and B) which I would like to combine into a 3x3x3x3xN tensor.
More specifically I want to compute : C_ijklm = A_ijm B_klm
right now I am reshaping A and B into 9x1xN and 1x9xN arrays and I then use pagemtimes (or simply .* with singleton expansion) to generate the 9x9xN which is finally reshaped.
Is there an easier way? The resulting code lacks readability in my opinion.
I have read the tensorprod documentation but I don't see how I could use it. I would need some kind of "pageTensorprod" i think.
Thanks for any advice.
Adrien.

採用された回答

Matt J
Matt J 2023 年 3 月 23 日
編集済み: Matt J 2023 年 3 月 23 日
Is there an easier way? The resulting code lacks readability in my opinion.
Probably not, but regardless, readability shouldn't be the reason to look for another solution. You can hide the operations that look ugly to you in a function of your own.
  1 件のコメント
Adrien Leygue
Adrien Leygue 2023 年 3 月 24 日
I was expecting this answer. I just like to have things that are easy to read and therefore to maintain.
Thx

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by