src/sparse_matrix.rb
# A matrix is diagonal if all entries outside the main diagonal are 0.
A matrix is diagonal if all entries outside the main diagonal are 0.
A matrix is diagonal if all entries outside the main diagonal are 0 .
def diagonal?
        return false if not square?
        @sparse_hash.each {|point, val| return false if point.x != point.y}
        true
    end
def diagonal? return false if not square? @sparse_hash . each { | point , val | return false if point . x != point . y } true end
A matrix is diagonal if all entries outside the main diagonal are 0.
A matrix is diagonal if all entries outside the main diagonal are 0 .