Alternatives to accumarray for faster calculations?
Ahora está siguiendo esta pregunta
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
0 votos
Comparte un enlace a esta pregunta
Respuesta aceptada
3 votos
Comparte un enlace a esta respuesta
9 comentarios
Comparte un enlace a este comentario
Comparte un enlace a este comentario
- In your vectorized code, A N and B are not gpuArrays initially! Be careful not to mix GPU and CPU computations unless you mean to. Otherwise, you won't be able to trust your performance results.
- In the original code R doesn't depend on k. I took it out of the loop and pre-computed it together with the number of times you update N and B in the original code (represented by sumR).
- I made extensive use of implicit expansion which can be useful in these cases (for example R==uniqueR'). Note that implicit expansion might limit the size of the problems you can work on...but I think it'll be fine in this case.
- Also, R is very regular and you should be able to generate its values in a much faster way! You should be able to find a closed form expression to give you numR given the row index.
- If you keep working on something like this, I'm sure you can make it much faster!
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Más respuestas (0)
Categorías
Más información sobre Matrices and Arrays en Centro de ayuda y File Exchange.
Etiquetas
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
