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!