Sha256: 8a6aeb05a10d538611a8bda828af03db4c9a4d2955dfa3a530f162be58a3ef89

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

require 'rubypython'
require 'matrix'

# 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

2 entries across 2 versions & 2 rubygems

Version Path
ilm-0.0.1 lib/matrix_overrides.rb
eulim-0.0.17 lib/matrix_overrides.rb