Class: Matrix
- Inherits:
-
Object
- Object
- Matrix
- Defined in:
- lib/matrix_overrides.rb
Overview
this class is extension of Matrix class offered by ruby
Instance Method Summary collapse
Instance Method Details
#nullspace_array ⇒ Object
19 20 21 |
# File 'lib/matrix_overrides.rb', line 19 def nullspace_array nullspace_as_string[2..-3].split(' ').map(&:to_r) end |
#nullspace_as_string ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/matrix_overrides.rb', line 6 def nullspace_as_string a = to_a RubyPython.start main = RubyPython.import('__main__') RubyPython::Python.PyRun_SimpleString <<-PYTHON from sympy import Matrix import numpy as np def null_space(a): return np.array_str(np.array(Matrix(a).nullspace())) PYTHON main.null_space(a).rubify end |