sum slices of 3-d matrix

1 visualización (últimos 30 días)
Paolo
Paolo el 24 de Mzo. de 2018
Comentada: Joss Knight el 25 de Mzo. de 2018
Hello, I have a 3-d matrix A(n,m,k) and I would like to sum each others, the slices A(n,m) such that the output is the new matrix B(n,m) = A(n,m,1) + A(n,m,2) + ... + A(n,m,k)
the matrix could be quite huge; so if you could suggest a solution which use the parallel computing toolbox / gpu it would be really useful.
Thank you Best regards, P

Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de Mzo. de 2018
B = sum(A, 3)
For large matrices MATLAB will automatically invoke a high performance multithreaded library to do the calculation. You would not be able to get high performance by using the Parallel Computing toolbox.
  1 comentario
Joss Knight
Joss Knight el 25 de Mzo. de 2018
Well...maybe not using a parallel pool, but for a large matrix it should run faster on the GPU.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre GPU Computing 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!

Translated by