Permalink
Browse files

Removed testing code, created Gemspec; using Jeweler

  • Loading branch information...
willcannings committed Mar 17, 2010
1 parent e7dff37 commit 3d09f8843ec2891d7c39f53f1262289ecd616e0f
View
@@ -0,0 +1,5 @@
+README.rdoc
+lib/**/*.rb
+bin/*
+features/**/*.feature
+LICENSE
View
@@ -0,0 +1,2 @@
+Public Domain
+
View
@@ -0,0 +1,54 @@
+require 'rubygems'
+require 'rake'
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = "ruby-svd"
+ gem.summary = "SVD for Ruby"
+ gem.description = "Singular Value Decomposition with no dependency on GSL or LAPACK"
+ gem.email = "me@willcannings.com"
+ gem.homepage = "http://github.com/willcannings/ruby-svd"
+ gem.authors = ["Will"]
+ gem.files = ["lib/*", "ext/*"]
+ gem.require_paths = ['lib', 'ext']
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+ end
+ Jeweler::GemcutterTasks.new
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+end
+
+require 'rake/testtask'
+Rake::TestTask.new(:test) do |test|
+ test.libs << 'lib' << 'test'
+ test.pattern = 'test/**/test_*.rb'
+ test.verbose = true
+end
+
+begin
+ require 'rcov/rcovtask'
+ Rcov::RcovTask.new do |test|
+ test.libs << 'test'
+ test.pattern = 'test/**/test_*.rb'
+ test.verbose = true
+ end
+rescue LoadError
+ task :rcov do
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
+ end
+end
+
+task :test => :check_dependencies
+
+task :default => :test
+
+require 'rake/rdoctask'
+Rake::RDocTask.new do |rdoc|
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
+
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "ruby-svd #{version}"
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
View
@@ -1 +1 @@
-0.0.0
+0.1.0
File renamed without changes.
File renamed without changes.
View
File renamed without changes.
View
File renamed without changes.
View
@@ -0,0 +1,3 @@
+require 'svd'
+require 'svd_matrix'
+
@@ -23,58 +23,19 @@ def inspect
def lsa
input_array = []
@rows.each {|row| input_array += row}
- p input_array
u_array, w_array, v_array = SVD.decompose(input_array, row_size, column_size)
- puts "\nU Array:"
- p u_array
u = SVDMatrix.new(row_size, column_size)
row_size.times {|i| u[i] = u_array.slice!(0,column_size)}
- puts "\nU Matrix:"
- puts u.inspect
- puts "\nV Array"
- p v_array
v = SVDMatrix.new(column_size, column_size)
column_size.times {|i| v[i] = v_array.slice!(0,column_size)}
- #v = v.transpose
- puts "\nV Matrix"
v = v.transpose
- column_size.times {|i| puts "#{v.row(i).inspect}\n"}
- #puts v.inspect
- puts "\nW Matrix"
w_array = w_array[0...2] + Array.new(w_array.size - 2).collect {|i| 0}
w = Matrix.diagonal(*w_array)
- puts w.inspect
- puts "--------------------------------\n"
r = (u * w * v)
- row_size.times {|i| puts "#{r.row(i).inspect}\n"}
end
end
-# m = SVDMatrix.new(6, 4)
-# m[0] = [5,5,0,5]
-# m[1] = [5,0,3,4]
-# m[2] = [3,4,0,3]
-# m[3] = [0,0,5,3]
-# m[4] = [5,4,4,5]
-# m[5] = [5,4,5,5]
-# m.lsa
-
-m = SVDMatrix.new(12, 9)
-m[0] = [1,0,0,1,0,0,0,0,0]
-m[1] = [1,0,1,0,0,0,0,0,0]
-m[2] = [1,1,0,0,0,0,0,0,0]
-m[3] = [0,1,1,0,1,0,0,0,0]
-m[4] = [0,1,1,2,0,0,0,0,0]
-m[5] = [0,1,0,0,1,0,0,0,0]
-m[6] = [0,1,0,0,1,0,0,0,0]
-m[7] = [0,0,1,1,0,0,0,0,0]
-m[8] = [0,1,0,0,0,0,0,0,1]
-m[9] = [0,0,0,0,0,1,1,1,0]
-m[10] = [0,0,0,0,0,0,1,1,1]
-m[11] = [0,0,0,0,0,0,0,1,1]
-m.lsa
-
View
Binary file not shown.
View
@@ -0,0 +1,44 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{ruby-svd}
+ s.version = "0.1.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Will"]
+ s.date = %q{2010-03-18}
+ s.description = %q{Singular Value Decomposition with no dependency on GSL or LAPACK}
+ s.email = %q{me@willcannings.com}
+ s.extensions = ["ext/extconf.rb"]
+ s.extra_rdoc_files = [
+ "LICENSE",
+ "README"
+ ]
+ s.files = [
+ "ext/extconf.rb",
+ "ext/nrutil.h",
+ "ext/svd.c",
+ "ext/svd.h",
+ "lib/ruby-svd.rb",
+ "lib/svd_matrix.rb"
+ ]
+ s.homepage = %q{http://github.com/willcannings/ruby-svd}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib", "ext"]
+ s.rubygems_version = %q{1.3.6}
+ s.summary = %q{SVD for Ruby}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ else
+ end
+ else
+ end
+end
+

0 comments on commit 3d09f88

Please sign in to comment.