Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Patrick Roland <patrick.rolande@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Why is Mata much slower than MATLAB at matrix inversion? |

Date |
Fri, 20 Jul 2012 16:14:57 -0700 |

To be clear, my point was that all Mata matrix inverse functions are slower than MATLAB. It does seem though that this is not true for small matrices (e.g. 100x100), but the difference is easily an order of magnitude when it comes to larger matrices (2000x2000). The fact that I compared cholinv() and a general inverse function should be to Mata's favor, since cholinv should presumably be faster if it exploits the special structure of the matrix. X'X is positive definite if X is invertible (as in my example), because a'X'Xa = (Xa)'(Xa) > 0. On Fri, Jul 20, 2012 at 2:48 PM, David M. Drukker <ddrukker@stata.com> wrote: > Patrick Roland <patrick.rolande@gmail.com> posted that the Mata function > -cholinv()- is slower than a Matlab function for large matrices. > > Others have discussed some issues with Patrick's example. Despite these > issues, we took Patrick's post seriously, looked at the code, and found > something that could be sped up. > > We will release a faster version of -cholinv()- in an upcoming executable > update. > > Note that any speed difference related to -cholinv()- is only noticeable for > large matrices. For small matrices, such as variance-covariance matrices > for models with 100 or fewer parameters, the difference is much harder to > find. For example, the computation takes about .001 seconds on my machine. > > Best, > David > ddrukker@stata.com > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: Why is Mata much slower than MATLAB at matrix inversion?***From:*Richard Herron <richard.c.herron@gmail.com>

**References**:**st: Why is Mata much slower than MATLAB at matrix inversion?***From:*Patrick Roland <patrick.rolande@gmail.com>

**Re: st: Why is Mata much slower than MATLAB at matrix inversion?***From:*"David M. Drukker" <ddrukker@stata.com>

- Prev by Date:
**st: Am I using the correct Regression command/method?** - Next by Date:
**Re: st: vi/vim and Stata integration under Unix/Linux** - Previous by thread:
**Re: st: Why is Mata much slower than MATLAB at matrix inversion?** - Next by thread:
**Re: st: Why is Mata much slower than MATLAB at matrix inversion?** - Index(es):