Multiplication of very large 2D and 3D matrices

1 vue (au cours des 30 derniers jours)
ebon T
ebon T le 23 Oct 2020
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 commentaire
Mitchell Thurston
Mitchell Thurston le 23 Oct 2020
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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by