ruby-svd 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/ext/svd.c +2 -2
  2. data/lib/svd_matrix.rb +3 -3
  3. metadata +6 -4
data/ext/svd.c CHANGED
@@ -18,13 +18,13 @@ VALUE decompose(VALUE module, VALUE matrix_ruby, VALUE m_ruby, VALUE n_ruby) {
18
18
  VALUE w_output = rb_ary_new();
19
19
  VALUE output = rb_ary_new();
20
20
 
21
- // precondition
21
+ /* precondition */
22
22
  if((m*n) != RARRAY_LEN(matrix_ruby)) {
23
23
  rb_raise(rb_eRangeError, "Size of the array is not equal to m * n");
24
24
  return;
25
25
  }
26
26
 
27
- // convert to u matrix
27
+ /* convert to u matrix */
28
28
  for(i = 1; i <= m; i++) {
29
29
  for(j = 1; j <= n; j++) {
30
30
  offset = ((i-1)*n) + (j-1);
@@ -41,11 +41,11 @@ class SVDMatrix < Matrix
41
41
 
42
42
  # recompose U matrix
43
43
  u = SVDMatrix.new(row_size, reduce_dimensions_to || column_size)
44
- row_size.times {|i| u.set_row(i, u_array.slice!(0, column_size)[0...reduce_dimensions_to])}
44
+ row_size.times {|i| u.set_row(i, u_array.slice!(0, column_size)[0...(reduce_dimensions_to || column_size)])}
45
45
 
46
- # recompose V matric
46
+ # recompose V matrix
47
47
  v = SVDMatrix.new(column_size, reduce_dimensions_to || column_size)
48
- column_size.times {|i| v.set_row(i, v_array.slice!(0, column_size)[0...reduce_dimensions_to])}
48
+ column_size.times {|i| v.set_row(i, v_array.slice!(0, column_size)[0...(reduce_dimensions_to || column_size)])}
49
49
 
50
50
  # diagonalise W array as a matrix
51
51
  if reduce_dimensions_to
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
8
7
  - 5
9
- version: 0.4.5
8
+ - 0
9
+ version: 0.5.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Will Cannings
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-19 00:00:00 +11:00
17
+ date: 2010-09-30 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -48,6 +48,7 @@ require_paths:
48
48
  - lib
49
49
  - ext
50
50
  required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
51
52
  requirements:
52
53
  - - ">="
53
54
  - !ruby/object:Gem::Version
@@ -55,6 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
56
  - 0
56
57
  version: "0"
57
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
58
60
  requirements:
59
61
  - - ">="
60
62
  - !ruby/object:Gem::Version
@@ -64,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
66
  requirements: []
65
67
 
66
68
  rubyforge_project:
67
- rubygems_version: 1.3.6
69
+ rubygems_version: 1.3.7
68
70
  signing_key:
69
71
  specification_version: 3
70
72
  summary: SVD for Ruby