Scilab Function

sum - sum (row sum, column sum) of vector/matrix entries

Calling Sequence

y=sum(x)
y=sum(x,'r') or y=sum(x,1)
y=sum(x,'c') or y=sum(x,2)

Parameters

Description

For a vector or a matrix x, y=sum(x) returns in the scalar y the sum of all the entries of x.

y=sum(x,'r') (or, equivalently, y=sum(x,1)) is the rowwise sum: y(j)= sum(x(:,j)). y is a row vector

y=sum(x,'c') (or, equivalently, y=sum(x,2)) is the columnwise sum. It returns in each entry of the column vector y the sum : y(i)= sum(x(i,:)))).

Examples

See Also