Class: Array

Inherits:
Object show all
Defined in:
lib/jblas/extensions.rb

Overview

Extensions to Ruby’s Array class

Instance Method Summary collapse

Instance Method Details

#to_matObject

Convert array to matrix.



49
50
51
# File 'lib/jblas/extensions.rb', line 49

def to_mat
  JBLAS::DoubleMatrix[*self]
end

#to_matlab_stringObject

Convert array to matrix string representation



54
55
56
# File 'lib/jblas/extensions.rb', line 54

def to_matlab_string
  '[' + map{|e| e.to_s}.join(', ') + ']'
end