Multiplication of very large 2D and 3D matrices
1 回表示 (過去 30 日間)
古いコメントを表示
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:
- c is extremely large. So, it is impossible to keep it in memory.
- 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
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 Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!