Sha256: c708a83a0c4ad95e2dfc908f58e0d584336acf845be4f1f41ac0064d99126373

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

require 'matrix'

class GLM::Util
  def self.formatArrays(x, y)
    x = Matrix.rows(x)
    y = Matrix.column_vector(y)
    return [x, y]
  end

  #Construct a GSL::Matrix out of an Array of Arrays, should have been in GSL::Matrix already
  def self.aa_to_gsl_matrix(aa)
    n_rows = aa.length
    n_cols = aa[0].length
    gmat = GSL::Matrix.alloc n_rows,n_cols
    (0...n_rows).each {|i|
      (0...n_cols).each {|j|
        gmat.set i, j, aa[i][j]}}
    return gmat
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glm-0.0.2 lib/glm/util.rb