Announcement

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

  • How to sum matrices in an array

    Hello,
    I am new to mata. I made an array of matrices in mata and I want to sum all the matrices in the array.
    In R, the function apply(x, c(1,2), sum) does this.
    Can anyone here help.
    Thank you!

  • #2
    I find your question very hard to understand, since there are not any three dimensional matrices in Mata, and at least I have not heard the terminology "array of matrices" in a Mata context. Show us (using, perhaps, -mata describe-) how you have set up your array of matrices. Then clarify what you mean by "sum all the matrices.?" Do you mean, find the sum of all the elements in *each* of the matrices? Note that many (most?) of us are not R users, so describing what the R construct is does not help much.

    Comment


    • #3
      Julius: Are you referring to an associative array
      Code:
      help mf_asarray
      or to something else?

      Comment

      Working...
      X