How to find sum of all elements of a matrix in sagemath
I have a matrix of order n say M. If I do sum(M) I would get the a vector in which all the entries would give me the sum of elements of each row of M.
How can I find the sum of all elements of M? Does there exist any command which can return the sum of all elements of a matrix?
Please help me out.
add a comment