Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

16
  • 2
    $\begingroup$ @ShutaoTang does the update answer your question about "how to store and organize the intermediate result?" (Namely, don't copy it around.) $\endgroup$ Commented Apr 4, 2015 at 4:15
  • $\begingroup$ You can use Compile`GetElement to speed up doolittleDecomposition by a factor of 2. (See here for an example. ) $\endgroup$ Commented Apr 4, 2015 at 4:25
  • 1
    $\begingroup$ +1Nice answer,thanks a lot. In fact, I'd like to implement this algorithm in functional paradigm(like Nest, because I think functional paradigm is more efficient) at the beginning. However, I didn't know how to organize the intermediate result(like $u_{11},u_{12} \cdots u_{1n}$). So I use the Do(I am always thinking it is not efficient in Mathematica) to implement it. In addition, @Daniel Lichtblau gave the suggestion(changing the Sum to dot products), but I forgot to use the built-in functionSpan(;;) . So your edit fo my original code is very elegant:) $\endgroup$ Commented Apr 4, 2015 at 4:35
  • 2
    $\begingroup$ @ShutaoTang The Doolittle algorithm is essentially procedural: shoehorning it into a functional construct will not make it faster. The reason we advise a functional style most of the time is that builtins are usually faster; but there are no builtins that apply to this case. I believe my testing shows that here, Do is faster than Nest. $\endgroup$ Commented Apr 4, 2015 at 4:40
  • 1
    $\begingroup$ @Alittle LU decomposition is in general not unique, so if the built-in function uses a different algorithm it can yield a different result. $\endgroup$ Commented Sep 20, 2020 at 18:13