Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Matrix multiplication algorithm in Mata (for big matrices)

    Dear Statalist,

    I was wondering if anyone has code some algorithm in Mata in order to multiply big matrices in Mata, and test the performance using some big O notation.

    I looked the Mata manual and some quad functions, it was not clear to me if Stata has implemented some algorithms (simple looping, partition, or others).

    The WiKi page has a nice picture of the performance with different methods, but I was not able to see if there is any real applications for some of that.

    Any thoughts on our Mata users and Stata Corp?

    Reference:
    https://en.wikipedia.org/wiki/Matrix...tion_algorithm

    Best,
    Minh
    Attached Files
    Last edited by Minh Nguyen; 26 Apr 2016, 17:29.

  • #2
    How are you defining a "big" matrix? There might be more efficient implementations in some of the machine learning/big data stacks, but the use cases are fairly different from the typical Stata use case (e.g., developing recommender systems, etc...). Maybe if you could provide some parameters around your question it would be easier for others to respond with useful/helpful input?

    Comment


    • #3
      Many thanks. Big matrices in our case normally 5 million+ rows and 100+ columns (normally need 3.7GB of memory for a matrix). With StataMP and large memory (16+ cores and 32GB+), Mata can do it well for multiplication within 10 minutes. I was wondering if there are any faster way to multiply those big matrices such as (5 millions, 100)*(100,100), those matrices are real.

      best,
      Minh

      Comment


      • #4
        Minh Nguyen --

        Those are definitely big matrices. Have you tried breaking multiplication a big matrix into smaller matrices, multiplying the pieces in parallel, and then recombining them with addition? I've found this to be helpful in some instances. A little writeup on "Divide and Conquer" can be found here:

        https://en.wikipedia.org/wiki/Matrix...tion_algorithm

        Comment

        Working...
        X