Multiplying each row vector with each column vector.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sameer Karim
el 12 de Abr. de 2018
Respondida: KSSV
el 12 de Abr. de 2018
I have two matrix X and Y of shape 7800x784 and 784x7800. X !=Y'. I want to multiply each row of X with each column of Y to get a 7800x1 matrix. Basically I want the diagonal elements of X*Y matrix without performing the redundant operations. Is there a vectorised way of performing this operation? Thanks!!
0 comentarios
Respuesta aceptada
KSSV
el 12 de Abr. de 2018
X = rand(7800,784) ;
Y = rand(784,7800) ;
Z = zeros(1,7800) ;
for i = 1:7800
Z(i) = X(i,:)*Y(:,i) ;
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Operating on Diagonal Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!