Further improvement of matrix inversion
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
acivil acivil
el 28 de Abr. de 2017
Comentada: acivil acivil
el 29 de Abr. de 2017
Using A\b instead of A^(-1) can be used to speed up a code. 1) How can we further speed up this inversion if we know from the beginning that Cholesky decomposition can apply in our matrix? 2)If we are about to use the inverse matrix to multiply it for more than one b vectors then A\b is still faster or we should save the inverse A^(-1) and then only do the multiplications? Is there a general rule for the number of inversions that one way is faster than the other? 3)If we create a mex file from a function that only contains the A\b command can we speed up the code execution or A\b is fully optimized?
Thank you in advance!
1 comentario
John Chilleri
el 28 de Abr. de 2017
Not sure if this is the place to ask for help on such a problem, but here's a hint on number 1.
Respuesta aceptada
James Tursa
el 28 de Abr. de 2017
How can we further speed up this inversion if we know from the beginning that Cholesky decomposition can apply in our matrix?
You could possibly speed things up by a small fraction by skipping some of the up-front checking, but I don't know if the effort would be worth it.
If we are about to use the inverse matrix to multiply it for more than one b vectors then A\b is still faster or we should save the inverse A^(-1) and then only do the multiplications? Is there a general rule for the number of inversions that one way is faster than the other?
It would be faster to simply combine all of your b vectors into one matrix and then do A\bcombined.
If we create a mex file from a function that only contains the A\b command can we speed up the code execution or A\b is fully optimized?
For speed & accuracy the mex file would likely simply call the exact same BLAS and LAPACK library routines that MATLAB is already calling. So no speed improvement would be expected.
7 comentarios
John D'Errico
el 28 de Abr. de 2017
Editada: John D'Errico
el 28 de Abr. de 2017
Call linsolve with L and L', using the OPTS argument to indicate if the matrix is lower or upper triangular.
Linsolve is indeed faster than simple use of backslash, since it does not need to determine if the matrix is really lower or upper triangular. Not needing to check will give a little improve speed boost.
The possible field names in OPTS and their corresponding matrix
properties are:
Field Name : Matrix Property
------------------------------------------------
LT : Lower Triangular
UT : Upper Triangular
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear Algebra 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!