[DRE-commits] [SCM] ruby-fftw3.git branch, master, updated. upstream/0.4-8-g60ec651
Youhei SASAKI
uwabami at gfd-dennou.org
Sun May 29 22:09:24 UTC 2011
The following commit has been merged in the master branch:
commit 60ec651f0213054d3acba75695f28f0725fbb073
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date: Fri May 13 12:30:54 2011 +0900
fix narray dir for vendorarchdir, refact test
Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
diff --git a/debian/changelog b/debian/changelog
index 8b10626..78ae48c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ruby-fftw3 (0.4-2) unstable; urgency=low
+
+ * Drop libnarray-rubyXX from Build-Depends
+ * Fix narray dir from archdir to vendorarchdir (Closes: Bug#628284)
+ * Refactoring test case
+
+ -- Youhei SASAKI <uwabami at gfd-dennou.org> Wed, 18 May 2011 08:11:08 +0900
+
ruby-fftw3 (0.4-1) unstable; urgency=low
* Initial release (Closes: Bug#546748)
diff --git a/debian/patches/FixLibraryPath b/debian/patches/FixLibraryPath
index e19e7ed..0d1a29e 100644
--- a/debian/patches/FixLibraryPath
+++ b/debian/patches/FixLibraryPath
@@ -5,7 +5,7 @@
-dir_config('narray',$sitearchdir,$sitearchdir)
-dir_config('fftw3','/usr/local')
-+dir_config('narray',$archdir,$archdir)
++dir_config('narray',$vendorarchdir,$vendorarchdir)
+dir_config('fftw3','/usr')
if ( ! ( have_header("narray.h") && have_header("narray_config.h") ) ) then
diff --git a/debian/patches/RefactTestCases b/debian/patches/RefactTestCases
index a4e428e..043c5ea 100644
--- a/debian/patches/RefactTestCases
+++ b/debian/patches/RefactTestCases
@@ -1,71 +1,76 @@
---- /dev/null
-+++ ruby-fftw3-0.4/test/test_fftw3.rb
-@@ -0,0 +1,68 @@
-+$:.unshift(File.dirname(__FILE__), ".", "lib")
+--- ruby-fftw3.orig/test/complexFFT.rb
++++ ruby-fftw3/test/complexFFT.rb
+@@ -1,38 +1,39 @@
+-require "numru/fftw3"
++$:.unshift(File.join(File.dirname(__FILE__), ".."))
+require "test/unit"
+require "fftw3"
-+include NumRu
-+
-+module FFTW3Test
-+
-+ I = Complex::I
-+
-+ def assert_narray(expected, actual, delta=nil, message="")
-+ unless delta
-+ case actual.typecode
-+ when NArray::SFLOAT, NArray::SCOMPLEX
-+ delta = 5.0e-5
-+ when NArray::DFLOAT, NArray::DCOMPLEX
-+ delta = 1.0e-13
-+ when NArray::INT, NArray::LINT
-+ delta = 0
-+ else
-+ raise "typecode is invalid"
-+ end
-+ end
-+ if message.empty?
-+ message = <<EOF
-+<#{expected.inspect}>
-+and
-+<#{actual.inspect}>
-+expected to have maximan differnce <#{(expected-actual).abs.max}> within
-+<#{delta}>.
-+EOF
-+ end
-+ assert (expected - actual).abs.max <= delta, message
-+ end
-+end
-+
+ include NumRu
+
+-print "\n**TEST** all dimensions\n\n"
+-
+-na = NArray.float(8,4).fill(1) # will be corced to complex
+-na[1,1]=5
+-p na
+-fc = FFTW3.fft(na, -1)/na.length
+-p fc
+-p fc.real
+-
+-p FFTW3.fft(fc, 1).real
+-
+-print "\n**TEST** single float (treated as single if lib fftw3f exits)\n"
+-print " --- see http://www.fftw.org/fftw3_doc/Precision.html for more info\n\n"
+-na = NArray.sfloat(8,4).indgen!
+-fc = FFTW3.fft(na, -1)/na.length
+-p fc
+-p FFTW3.fft(fc, 1).real
+-
+-print "\n**TEST** dimension selection\n\n"
+-
+-fc = FFTW3.fft(na, -1, 0)/na.shape[0]
+-p fc
+-p FFTW3.fft(fc, 1, 0).real
+-fc = FFTW3.fft(na, -1, 1)/na.shape[1]
+-p fc
+-p FFTW3.fft(fc, 1, 1).real
+-
+-na = NArray.float(4,3,8,3)
+-na[1,1,1,0]= 1
+-p( fc=FFTW3.fft(na, -1, 0,2) / (na.shape[0]*na.shape[2]) )
+-p( fc=FFTW3.fft(na, -1, 1) / na.shape[1] )
+-p( fc=FFTW3.fft(na, -1, 0,1,2) / (na.shape[0]*na.shape[1]*na.shape[2]) )
+-p FFTW3.fft(fc, 1, 0,1,2).real
+class ComplexTest < Test::Unit::TestCase
-+ include FFTW3Test
-+
+
+ def setup
+ @na_double = NArray.float(8,4).fill(1.0)
+ @na_single = NArray.sfloat(8,4).indgen!
+ @na_complex = NArray.float(4,3,8,3)
+ @na_complex[1,1,1,0] = 1.0
++ @sfloat_delta = 5.0e-5
++ @float_delta = 1.0e-13
+ end
+
+ define_method("test_double_float") do
+ fc_double = FFTW3.fft(@na_double, -1)/@na_double.length
-+ assert_narray @na_double, FFTW3.fft(fc_double, 1).real
++ assert_in_delta @na_double, FFTW3.fft(fc_double, 1).real, @float_delta
+ end
+
+ define_method("test_single_float") do
+ fc_single = FFTW3.fft(@na_single, -1)/@na_single.length
-+ assert_narray @na_single, FFTW3.fft(fc_single, 1).real
++ assert_in_delta @na_single, FFTW3.fft(fc_single, 1).real, @sfloat_delta
+ end
+
+ define_method("test_dimenssion_selection") do
+ fc_double = FFTW3.fft(@na_double, -1, 0)/@na_double.shape[0]
-+ assert_narray @na_double, FFTW3.fft(fc_double, 1, 0).real
++ assert_in_delta @na_double, FFTW3.fft(fc_double, 1, 0).real, @float_delta
+ fc_single = FFTW3.fft(@na_single, -1, 0)/@na_single.shape[0]
-+ assert_narray @na_single, FFTW3.fft(fc_single, 1, 0).real
++ assert_in_delta @na_single, FFTW3.fft(fc_single, 1, 0).real, @sfloat_delta
+ end
+
+ define_method("test_complex") do
+ fc_complex = FFTW3.fft(@na_complex, -1, 0, 1, 2)/(@na_complex.shape[0]*@na_complex.shape[1]*@na_complex.shape[2])
-+ assert_narray @na_complex, FFTW3.fft(fc_complex, 1, 0, 1, 2).real
++ assert_in_delta @na_complex, FFTW3.fft(fc_complex, 1, 0, 1, 2).real, @float_delta
+ end
-+
+
+end
diff --git a/debian/ruby-tests.rb b/debian/ruby-tests.rb
index 562d8f5..f4c2b1f 100644
--- a/debian/ruby-tests.rb
+++ b/debian/ruby-tests.rb
@@ -1 +1 @@
-system("#{ENV['RUBY_TEST_BIN']} -I. test/test_fftw3.rb") or raise
+system("#{ENV['RUBY_TEST_BIN']} test/complexFFT.rb") or raise
diff --git a/extconf.rb b/extconf.rb
index 20104ad..8e53119 100644
--- a/extconf.rb
+++ b/extconf.rb
@@ -1,6 +1,6 @@
require "mkmf"
-dir_config('narray',$archdir,$archdir)
+dir_config('narray',$vendorarchdir,$vendorarchdir)
dir_config('fftw3','/usr')
if ( ! ( have_header("narray.h") && have_header("narray_config.h") ) ) then
diff --git a/test/complexFFT.rb b/test/complexFFT.rb
index e92f64e..76f215b 100644
--- a/test/complexFFT.rb
+++ b/test/complexFFT.rb
@@ -1,38 +1,39 @@
-require "numru/fftw3"
+$:.unshift(File.join(File.dirname(__FILE__), ".."))
+require "test/unit"
+require "fftw3"
include NumRu
-print "\n**TEST** all dimensions\n\n"
-
-na = NArray.float(8,4).fill(1) # will be corced to complex
-na[1,1]=5
-p na
-fc = FFTW3.fft(na, -1)/na.length
-p fc
-p fc.real
-
-p FFTW3.fft(fc, 1).real
-
-print "\n**TEST** single float (treated as single if lib fftw3f exits)\n"
-print " --- see http://www.fftw.org/fftw3_doc/Precision.html for more info\n\n"
-na = NArray.sfloat(8,4).indgen!
-fc = FFTW3.fft(na, -1)/na.length
-p fc
-p FFTW3.fft(fc, 1).real
-
-print "\n**TEST** dimension selection\n\n"
-
-fc = FFTW3.fft(na, -1, 0)/na.shape[0]
-p fc
-p FFTW3.fft(fc, 1, 0).real
-fc = FFTW3.fft(na, -1, 1)/na.shape[1]
-p fc
-p FFTW3.fft(fc, 1, 1).real
-
-na = NArray.float(4,3,8,3)
-na[1,1,1,0]= 1
-p( fc=FFTW3.fft(na, -1, 0,2) / (na.shape[0]*na.shape[2]) )
-p( fc=FFTW3.fft(na, -1, 1) / na.shape[1] )
-p( fc=FFTW3.fft(na, -1, 0,1,2) / (na.shape[0]*na.shape[1]*na.shape[2]) )
-p FFTW3.fft(fc, 1, 0,1,2).real
-
-
+class ComplexTest < Test::Unit::TestCase
+
+ def setup
+ @na_double = NArray.float(8,4).fill(1.0)
+ @na_single = NArray.sfloat(8,4).indgen!
+ @na_complex = NArray.float(4,3,8,3)
+ @na_complex[1,1,1,0] = 1.0
+ @sfloat_delta = 5.0e-5
+ @float_delta = 1.0e-13
+ end
+
+ define_method("test_double_float") do
+ fc_double = FFTW3.fft(@na_double, -1)/@na_double.length
+ assert_in_delta @na_double, FFTW3.fft(fc_double, 1).real, @float_delta
+ end
+
+ define_method("test_single_float") do
+ fc_single = FFTW3.fft(@na_single, -1)/@na_single.length
+ assert_in_delta @na_single, FFTW3.fft(fc_single, 1).real, @sfloat_delta
+ end
+
+ define_method("test_dimenssion_selection") do
+ fc_double = FFTW3.fft(@na_double, -1, 0)/@na_double.shape[0]
+ assert_in_delta @na_double, FFTW3.fft(fc_double, 1, 0).real, @float_delta
+ fc_single = FFTW3.fft(@na_single, -1, 0)/@na_single.shape[0]
+ assert_in_delta @na_single, FFTW3.fft(fc_single, 1, 0).real, @sfloat_delta
+ end
+
+ define_method("test_complex") do
+ fc_complex = FFTW3.fft(@na_complex, -1, 0, 1, 2)/(@na_complex.shape[0]*@na_complex.shape[1]*@na_complex.shape[2])
+ assert_in_delta @na_complex, FFTW3.fft(fc_complex, 1, 0, 1, 2).real, @float_delta
+ end
+
+end
diff --git a/test/test_fftw3.rb b/test/test_fftw3.rb
deleted file mode 100644
index 4817d71..0000000
--- a/test/test_fftw3.rb
+++ /dev/null
@@ -1,68 +0,0 @@
-$:.unshift(File.dirname(__FILE__), ".", "lib")
-require "test/unit"
-require "fftw3"
-include NumRu
-
-module FFTW3Test
-
- I = Complex::I
-
- def assert_narray(expected, actual, delta=nil, message="")
- unless delta
- case actual.typecode
- when NArray::SFLOAT, NArray::SCOMPLEX
- delta = 5.0e-5
- when NArray::DFLOAT, NArray::DCOMPLEX
- delta = 1.0e-13
- when NArray::INT, NArray::LINT
- delta = 0
- else
- raise "typecode is invalid"
- end
- end
- if message.empty?
- message = <<EOF
-<#{expected.inspect}>
-and
-<#{actual.inspect}>
-expected to have maximan differnce <#{(expected-actual).abs.max}> within
-<#{delta}>.
-EOF
- end
- assert (expected - actual).abs.max <= delta, message
- end
-end
-
-class ComplexTest < Test::Unit::TestCase
- include FFTW3Test
-
- def setup
- @na_double = NArray.float(8,4).fill(1.0)
- @na_single = NArray.sfloat(8,4).indgen!
- @na_complex = NArray.float(4,3,8,3)
- @na_complex[1,1,1,0] = 1.0
- end
-
- define_method("test_double_float") do
- fc_double = FFTW3.fft(@na_double, -1)/@na_double.length
- assert_narray @na_double, FFTW3.fft(fc_double, 1).real
- end
-
- define_method("test_single_float") do
- fc_single = FFTW3.fft(@na_single, -1)/@na_single.length
- assert_narray @na_single, FFTW3.fft(fc_single, 1).real
- end
-
- define_method("test_dimenssion_selection") do
- fc_double = FFTW3.fft(@na_double, -1, 0)/@na_double.shape[0]
- assert_narray @na_double, FFTW3.fft(fc_double, 1, 0).real
- fc_single = FFTW3.fft(@na_single, -1, 0)/@na_single.shape[0]
- assert_narray @na_single, FFTW3.fft(fc_single, 1, 0).real
- end
-
- define_method("test_complex") do
- fc_complex = FFTW3.fft(@na_complex, -1, 0, 1, 2)/(@na_complex.shape[0]*@na_complex.shape[1]*@na_complex.shape[2])
- assert_narray @na_complex, FFTW3.fft(fc_complex, 1, 0, 1, 2).real
- end
-
-end
--
ruby-fftw3.git
More information about the Pkg-ruby-extras-commits
mailing list