![]() ![]() We want to represent "A" as "L U" using "LU decomposition" function embedded in matlab thus: If any one approach is better than another depends on your particular situation and is something you would need to investigate more. One other thing to note: the implementation from the question does not do any pivoting, so its numerical stability will generally be worse than an implementation that does pivoting, and it will even fail for some nonsingular matrices.ĭifferent variants of Gaussian elimination exist, but they are all O( n 3) algorithms. If, however, you are determined to use your own implementation and want it to be faster, one option is to look for ways to vectorize your implementation (maybe start here). ![]() The algorithms used by mldivide and lu are from C and Fortran libraries, and your own implementation in Matlab will never be as fast. Note that mldivide can do more than Gaussian elimination (e.g., it does linear least squares, when appropriate). Unless you are specifically looking to implement your own, you should use Matlab's backslash operator ( mldivide) or, if you want the factors, lu. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |