Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

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


From   Richard Herron <[email protected]>
To   [email protected]
Subject   Re: st: Why is Mata much slower than MATLAB at matrix inversion?
Date   Fri, 20 Jul 2012 21:19:37 -0400

Snap. Yes, your m from -runiform()- will certainly be invertible.

Richard Herron


On Fri, Jul 20, 2012 at 7:14 PM, Patrick Roland
<[email protected]> wrote:
> 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 <[email protected]> wrote:
>> Patrick Roland <[email protected]> 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
>> [email protected]
>>
>>
>> *
>> *   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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index