Ruby | Matrix diagonal() function
The diagonal is an inbuilt method in Ruby returns a matrix with diagonal elements as the given values. Syntax: mat1.diagonal(val1, val2, val3 ...) Parameters: The function accepts the values which are to be placed in the diagonal of the matrix. Return Value: It returns matrix with values val1, val2,