element

element(i, j) Instance Public methods Alias for: []

eigensystem

eigensystem() Instance Public methods Returns the Eigensystem of the matrix; see EigenvalueDecomposition. m = Matrix[[1, 2], [3, 4]] v, d, v_inv = m.eigensystem d.diagonal? # => true v.inv == v_inv # => true (v * d * v_inv).round(5) == m # => true eigen

eigen

eigen() Instance Public methods Alias for: eigensystem

each_with_index

each_with_index(which = :all) Instance Public methods Same as each, but the row index and column index in addition to the element Matrix[ [1,2], [3,4] ].each_with_index do |e, row, col| puts "#{e} at #{row}, #{col}" end # => Prints: # 1 at 0, 0 # 2 at 0, 1 # 3 at 1, 0 # 4 at 1, 1

each

each(which = :all) Instance Public methods Yields all elements of the matrix, starting with those of the first row, or returns an Enumerator is no block given. Elements can be restricted by passing an argument: :all (default): yields all elements :diagonal: yields only elements on the diagonal :off_diagonal: yields all elements except on the diagonal :lower: yields only elements on or below the diagonal :strict_lower: yields only elements below the diagonal :strict_upper

diagonal?

diagonal?() Instance Public methods Returns true is this is a diagonal matrix. Raises an error if matrix is not square.

determinant_e

determinant_e() Instance Public methods deprecated; use #determinant det_e

determinant

determinant() Instance Public methods Returns the determinant of the matrix. Beware that using Float values can yield erroneous results because of their lack of precision. Consider using exact types like Rational or BigDecimal instead. Matrix[[7,6], [3,9]].determinant => 45 det

det_e

det_e() Instance Public methods Alias for: determinant_e

det

det() Instance Public methods Alias for: determinant