Contents Previous Next Subchapters

Computing The Sum Of Each Row
Syntax rowsum(x)
See Also sum , colrange , rownorm , colsum

Description
If x is an integer, real, double-precision, or complex matrix, returns a column vector with the same type and row dimension as x containing the sum of each row. If x is a logical matrix, returns an integer column vector (with the same row dimension as x) containing the number of "true" entries in each row.

Example
     x = {[0., 2., 4.], [0., -1., 1.]}
     rowsum(x)
returns
     {
     6
     0
     }