lib/glm/util.rb in glm-0.0.1 vs lib/glm/util.rb in glm-0.0.2

- old
+ new

@@ -4,6 +4,18 @@ 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