How to use the sum function on a matrix to get the sum of the rows not the columns
5 views (last 30 days)
How to use the sum function on an array to get the sum of the rows not the columns :
I want to have an array of the sum of the rows of a matrix ( dimension $nxn$ ). When I use the sum function I get a sum of the columns.
If my matrix is called M the following code gives me what I want
However, this requires taking a transpose, is there a faster way to do this?