Skip to content

Commit

Permalink
Merge pull request #255 from kojix2/narray_format
Browse files Browse the repository at this point in the history
Set the default format for NArray to 'text/plain'.
  • Loading branch information
kojix2 authored Oct 20, 2019
2 parents 7ed6d07 + 5fbf7d9 commit b4bdd7e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/iruby/display.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ def format(mime = nil, &block)
end

type { Numo::NArray }
format 'text/plain' do |obj|
obj.inspect
end
format 'text/latex' do |obj|
obj.ndim == 2 ?
LaTeX.matrix(obj, obj.shape[0], obj.shape[1]) :
Expand All @@ -180,6 +183,9 @@ def format(mime = nil, &block)
end

type { NArray }
format 'text/plain' do |obj|
obj.inspect
end
format 'text/latex' do |obj|
obj.dim == 2 ?
LaTeX.matrix(obj.transpose(1, 0), obj.shape[1], obj.shape[0]) :
Expand Down

0 comments on commit b4bdd7e

Please sign in to comment.