OSDN Git Service

use linear regression to solve system. this is a workaround for singular matrix.
authortkaneko <tkaneko@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sun, 9 Mar 2008 11:49:21 +0000 (11:49 +0000)
committertkaneko <tkaneko@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sun, 9 Mar 2008 11:49:21 +0000 (11:49 +0000)
mk_rate

diff --git a/mk_rate b/mk_rate
index 8249873..b6d2160 100755 (executable)
--- a/mk_rate
+++ b/mk_rate
@@ -282,7 +282,8 @@ class Rating
       $stderr.puts "f: %s -> %f" % [f.to_a.inspect, f.nrm2] if $DEBUG
 
       # GSL::Linalg::LU.solve or GSL::Linalg::HH.solve would be available instead.
       $stderr.puts "f: %s -> %f" % [f.to_a.inspect, f.nrm2] if $DEBUG
 
       # GSL::Linalg::LU.solve or GSL::Linalg::HH.solve would be available instead.
-      a = GSL::Linalg::HH.solve(j, f)
+      #a = GSL::Linalg::HH.solve(j, f)
+      a, = GSL::MultiFit::linear(j, f)
       a = self.class.average(a)
       # $stderr.puts "a: %s -> %f" % [a.to_a.inspect, a.nrm2] if $DEBUG
       
       a = self.class.average(a)
       # $stderr.puts "a: %s -> %f" % [a.to_a.inspect, a.nrm2] if $DEBUG