Module: Spark::Mllib::Matrices

Defined in:
lib/spark/mllib/matrix.rb

Class Method Summary collapse

Class Method Details

.dense(*args) ⇒ Object



5
6
7
# File 'lib/spark/mllib/matrix.rb', line 5

def self.dense(*args)
  DenseMatrix.new(*args)
end

.sparse(*args) ⇒ Object



9
10
11
# File 'lib/spark/mllib/matrix.rb', line 9

def self.sparse(*args)
  SparseMatrix.new(*args)
end

.to_matrix(data) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/spark/mllib/matrix.rb', line 13

def self.to_matrix(data)
  if data.is_a?(SparseMatrix) || data.is_a?(DenseMatrix)
    data
  elsif data.is_a?(Array)
    DenseMatrix.new(data)
  end
end