[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: summing up matrix elements
. mata : sum_r = (sum(C) - trace(C)) / 2
R.E. De Hoyos
> > Is there a way to to get a scalar containing the sum of the
> > off-diagonal
> > elements of a pre-defined matrix?
> > For instance, define matrix C as a correlation matrix. I
> > want to know what
> > is the sum of correlations between the various elements in C.
> > Therefore I
> > need the sum of all elements in C minus the sum of the
> > diagonal elements
> > (-trace(C)-) and finally divide it by 2 (I am assuming matric C is
> > symetric).
* For searches and help try: