Multiplication of very large 2D and 3D matrices

1 回表示 (過去 30 日間)
ebon T
ebon T 2020 年 10 月 23 日
コメント済み: Mitchell Thurston 2020 年 10 月 23 日
I have an optimization problem with 2D variable matrix and 3D cost matrix. I need to minimize the multiplication of these two matrices*.
Variable matrix, V, is 1500x1500 and consists of only 0 and 1. Cost matrix, c, is 1500x1500x1M. V consists of origin-destination pairs. c consists of distances between pairs for every user (1M).
I have 2 problems:
  1. c is extremely large. So, it is impossible to keep it in memory.
  2. How can I multiply these two matrices in an efficient way?
*In brief, the variable matrix (1500x1500) should be constructed such that sum of the multiplication of it with every dimension of the cost matrix (1500x1500) is minimized.
  1 件のコメント
Mitchell Thurston
Mitchell Thurston 2020 年 10 月 23 日
This is what I would try:
result = zeros(1500);
for i = 1:1500
for k = 1:1500
if (V(i,k))
result(i,k) = sum(C(k,i,:));
end
end
end
I'm not positive on your index notation though.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by