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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by