Module: Hilbert::Api::MatrixApi
- Defined in:
- lib/hilbert/api/matrix_api.rb
Class Method Summary collapse
Class Method Details
.execute(rows) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/hilbert/api/matrix_api.rb', line 4 def execute(rows) row_count = rows.count column_count = rows.first.count case $meta_info.lang when :r "matrix(#{VectorApi.execute(rows.flatten)}, #{row_count}, #{column_count}, byrow = TRUE)" when :ruby arys_str = rows.map { |row| "[#{row.join(', ')}]" }.join(', ') "Matrix[#{arys_str}]" else fail "Matrix is not implemented for #{$meta_info.lang_str}" end end |