Sha256: 9fa8689e652e17942482f1f42e8f3d6c28a06fbb1c5b51ab71f77c91de914c6f

Contents?: true

Size: 497 Bytes

Versions: 3

Compression:

Stored size: 497 Bytes

Contents

require 'rubypython'
# this class is extension of Matrix class offered by ruby
class Matrix
  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

  def nullspace_array
    nullspace_as_string[2..-3].split(' ').map(&:to_r)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eulim-0.0.16 lib/matrix.rb
eulim-0.0.15 lib/matrix.rb
eulim-0.0.14 lib/matrix.rb