= private = protected
trace()
Returns the trace (sum of diagonal elements) of the matrix.
Matrix[[7,6], [3,9]].trace => 16
# File lib/matrix.rb, line 777 def trace tr = 0 0.upto(column_size - 1) do |i| tr += @rows[i][i] end tr end