Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hatappi/efdd4a79bfe2ada0712fe4028e9892c1 to your computer and use it in GitHub Desktop.
Save hatappi/efdd4a79bfe2ada0712fe4028e9892c1 to your computer and use it in GitHub Desktop.
require 'pycall/import'
include PyCall::Import
pyimport 'numpy', as: :np
x = np.matrix.([[1,2], [3, 4]])
# => matrix([[1, 2],
# [3, 4]])
y = np.matrix.([[5,6], [7, 8]])
# => matrix([[5, 6],
# [7, 8]])
z = x * y
# => matrix([[19, 22],
# [43, 50]])
z.max.()
# => 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment