[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Adding Matrices generated from a loop |

Date |
Fri, 24 Aug 2007 13:53:45 +0100 |

There may be subtleties here I am missing, but I would initialise sum <- first_matrix and then loop over the other matrices sum <- sum + next_matrix This is pseudocode. Otherwise I can't tell what's troubling you about this. As the details will depend on whether you are using Stata or Mata, your naming structure, what else you are doing with these matrices, whether the number is predictable in advance, etc., none of which is indicated, I'll leave it there. Nick n.j.cox@durham.ac.uk Nadeem Shafique > I want to add several matrices (say K) of the same order, suppose the > matrices to be added are comming from a loop, how can i calculate the > following > > K > Sum X_i > i=1 > where X_i is the ith Matix * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: RE: Adding Matrices generated from a loop***From:*"Nadeem Shafique" <nadeemshafique@gmail.com>

**References**:**st: Adding Matrices generated from a loop***From:*"Nadeem Shafique" <nadeemshafique@gmail.com>

- Prev by Date:
**RE: st: Maximum number of options in graph line** - Next by Date:
**Re: st: Maximum number of options in graph line** - Previous by thread:
**st: Adding Matrices generated from a loop** - Next by thread:
**Re: st: RE: Adding Matrices generated from a loop** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |