Permalink
Browse files

Fix an issue where decompose would fail if the optional second parame…

…ter wasn't supplied
  • Loading branch information...
willcannings committed Sep 30, 2010
1 parent bbaf343 commit d58cc3e0ff4a380c980216316fa3138b0892cb83
Showing with 3 additions and 3 deletions.
  1. +1 −1 .gitignore
  2. +2 −2 lib/svd_matrix.rb
  3. BIN pkg/ruby-svd-0.4.5.gem
View
@@ -2,4 +2,4 @@ Makefile
*.so
*.bundle
.DS_Store
-
+pkg/*
View
@@ -41,11 +41,11 @@ def decompose(reduce_dimensions_to = nil)
# recompose U matrix
u = SVDMatrix.new(row_size, reduce_dimensions_to || column_size)
- row_size.times {|i| u.set_row(i, u_array.slice!(0, column_size)[0...reduce_dimensions_to])}
+ row_size.times {|i| u.set_row(i, u_array.slice!(0, column_size)[0...(reduce_dimensions_to || column_size)])}
# recompose V matric
v = SVDMatrix.new(column_size, reduce_dimensions_to || column_size)
- column_size.times {|i| v.set_row(i, v_array.slice!(0, column_size)[0...reduce_dimensions_to])}
+ column_size.times {|i| v.set_row(i, v_array.slice!(0, column_size)[0...(reduce_dimensions_to || column_size)])}
# diagonalise W array as a matrix
if reduce_dimensions_to
View
Binary file not shown.

0 comments on commit d58cc3e

Please sign in to comment.