[narray-miss] 03/08: Add patch: remove include NumRu

Youhei SASAKI uwabami-guest at moszumanska.debian.org
Thu Jul 21 04:52:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

uwabami-guest pushed a commit to branch master
in repository narray-miss.

commit 89ec9582a662f66b9d3b5a0af84457772d4b4f0a
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date:   Sun Jul 3 19:20:58 2016 +0900

    Add patch: remove include NumRu
    
    Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
---
 debian/patches/0001-Remove-Non-ASCII-comment.patch | 185 ---------------------
 debian/patches/0001_fix_test_include_NumRu.patch   |  20 +++
 debian/patches/series                              |   2 +-
 3 files changed, 21 insertions(+), 186 deletions(-)

diff --git a/debian/patches/0001-Remove-Non-ASCII-comment.patch b/debian/patches/0001-Remove-Non-ASCII-comment.patch
deleted file mode 100644
index 338efc4..0000000
--- a/debian/patches/0001-Remove-Non-ASCII-comment.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From: Youhei SASAKI <uwabami at gfd-dennou.org>
-Date: Sat, 24 Nov 2012 12:15:40 +0900
-Subject: Remove Non-ASCII comment
-
-Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
----
- lib/narray_miss/narray_miss.rb |   41 ++++++++--------------------------------
- 1 file changed, 8 insertions(+), 33 deletions(-)
-
-diff --git a/lib/narray_miss/narray_miss.rb b/lib/narray_miss/narray_miss.rb
-index c7138df..4adcd44 100644
---- a/lib/narray_miss/narray_miss.rb
-+++ b/lib/narray_miss/narray_miss.rb
-@@ -257,7 +257,7 @@ go back to ((<Index>))
-      replace elements at ((|index|)) by ((|value|)).
- --- NArrayMiss#[]=(index, value)
-      replace elements at ((|index|)) by ((|value|)) and
--     make replaced elements valid.     
-+     make replaced elements valid.
- =end
- 
-   def [](*arg)
-@@ -557,7 +557,6 @@ go back to ((<Index>))
- 
-   def sum(*dims)
-     min_count = NArrayMiss.check_options(dims, 1)
--    # 欠損値に 0 を入れて普通に sum する
-     ary0 = @array.dup
-     ary0[@mask.not] = 0
-     NArrayMiss.reduction(@mask, rank, min_count, dims, false, typecode) do
-@@ -566,8 +565,6 @@ go back to ((<Index>))
-   end
-   def min(*dims)
-     min_count = NArrayMiss.check_options(dims, 1)
--    # 欠損値に最大値を入れて普通に min する
--    # byte,sint,int,sfloat,float の MAX の値を入れるように変更すべき
-     ary0 = @array.dup
-     ary0[@mask.not] = @array.max
-     NArrayMiss.reduction(@mask, rank, min_count, dims, false, typecode) do
-@@ -576,8 +573,6 @@ go back to ((<Index>))
-   end
-   def max(*dims)
-     min_count = NArrayMiss.check_options(dims, 1)
--    # 欠損値に最小値を入れて普通に max する
--    # byte,sint,int,sfloat,float の MIN の値を入れるように変更すべき
-     ary0 = @array.dup
-     ary0[@mask.not] = @array.min
-     NArrayMiss.reduction(@mask, rank, min_count, dims, false, typecode) do
-@@ -587,7 +582,6 @@ go back to ((<Index>))
- 
-   def mean(*dims)
-     min_count = NArrayMiss.check_options(dims, 1)
--    # 整数型の場合は浮動小数型へ変換
-     ary0 = self.integer? ? self.to_type(NArray::DFLOAT) : self
-     NArrayMiss.reduction(@mask, rank, min_count, dims, true, typecode) do |count_sum, count_accum|
-       ary0.sum(*dims)/count_sum
-@@ -595,7 +589,6 @@ go back to ((<Index>))
-   end
-   def stddev(*dims)
-     min_count = NArrayMiss.check_options(dims, 2)
--    # 整数型の場合は浮動小数型へ変換
-     ary0 = self.integer? ? self.to_type(NArray::DFLOAT) : self
-     NArrayMiss.reduction(@mask, rank, min_count, dims, true, typecode) do |count_sum, count_accum|
-       ary0 = ary0 - ary0.accum(*dims)/count_accum
-@@ -606,7 +599,6 @@ go back to ((<Index>))
-   end
-   def rms(*dims)
-     min_count = NArrayMiss.check_options(dims, 1)
--    # 整数型の場合は浮動小数型へ変換
-     ary0 = self.integer? ? self.to_type(NArray::DFLOAT) : self
-     NArrayMiss.reduction(@mask, rank, min_count, dims, true, typecode) do |count_sum, count_accum|
-       ary0 = ary0.abs if ary0.complex?
-@@ -616,7 +608,6 @@ go back to ((<Index>))
-   end
-   def rmsdev(*dims)
-     min_count = NArrayMiss.check_options(dims, 1)
--    # 整数型の場合は浮動小数型へ変換
-     ary0 = self.integer? ? self.to_type(NArray::DFLOAT) : self
-     NArrayMiss.reduction(@mask, rank, min_count, dims, true, typecode) do |count_sum, count_accum|
-       ary0 = ary0 - ary0.accum(*dims)/count_accum
-@@ -1011,7 +1002,7 @@ go back to ((<Index>))
- --- NArrayMiss#get_array
-      return (({NArray})) as data.
- --- NArrayMiss#valid?(index)
--     return (({Array})) whose elements are true or false, 
-+     return (({Array})) whose elements are true or false,
-      or (({True}))/(({False})) corresponding to validity of the specified element(s) by the ((|index|))
- --- NArrayMiss#all_valid?
-      return true if all elements are valid, else false.
-@@ -1021,7 +1012,7 @@ go back to ((<Index>))
-      alias to none_valid?
- --- NArrayMiss#any_valid?
-      return true if any elements are valid, else false.
--     
-+
- --- NArrayMiss#count_valid
-      return the number of valid elements.
- --- NArrayMiss#count_invalid
-@@ -1125,7 +1116,7 @@ go back to ((<Index>))
-       return @mask.count_true
-     else
-       return @mask.to_type(NArray::INT).sum(*arg)
--    end    
-+    end
-   end
-   def count_invalid(*arg)
-     if arg.length==0 then
-@@ -1273,8 +1264,6 @@ go back to ((<Index>))
-     result
-   end
-   def binary_operation(arg, dummy)
--    # arg: 第2項目のオブジェクト
--    # dummy: 演算を行っても結果に影響を与えない特別な値。(欠損部分に代入する)
-     flag=true
-     case arg
-     when Numeric
-@@ -1283,9 +1272,9 @@ go back to ((<Index>))
-       mask = @mask
-     when Array, NArray
-       term1 = @array.dup
--      term1[@mask.not] = dummy # 欠損部分に dummy を代入
--      term2 = arg.kind_of?(NArray) ? arg : NArray.to_na(arg) # Array -> NArray
--      mask = NArray.byte(*term2.shape).fill(1) # 2項目は欠損無し
-+      term1[@mask.not] = dummy
-+      term2 = arg.kind_of?(NArray) ? arg : NArray.to_na(arg)
-+      mask = NArray.byte(*term2.shape).fill(1)
-       mask = @mask & mask
-     when NArrayMiss
-       term1 = @array.dup
-@@ -1296,7 +1285,6 @@ go back to ((<Index>))
-       mask = @mask & mask
-     else
-       term1, term2 = arg.coerce(self)
--      # 演算を arg のクラスに任せるため、yield の結果をそのまま返す
-       flag = false
-     end
-     result = yield(term1, term2)
-@@ -1306,46 +1294,33 @@ go back to ((<Index>))
- 
- 
-   def self.reduction(mask, rank, min_count, dims, flag, typecode)
--    # flag: リダクションを行う次元方向の有効な値の個数で、割り算を行うかどうかのフラグ
-     count_sum = mask.to_type(NArray::LINT).sum(*dims)
--    # 返り値が配列か、スカラーかによって分岐
-     if count_sum.kind_of?(NArray)
-       mask = count_sum.ge(min_count)
--      # すべての要素が欠損値にならないかチェック
-       if mask.any?
-         count_accum = NArray.ref(count_sum)
-         dims.collect{|d|d<0 ? d+rank : d}.sort.each do |d|
-           count_accum.newdim!(d)
-         end
--        # 割り算を行う場合は、先に count_sum を NArrayMiss 化
--        #   yield の戻り値は NArrayMiss
--        # 割り算を行わない場合は、後で NArrayMiss 化
--        #   yield の戻り値は NArray
-         count_sum = NArrayMiss.to_nam_no_dup(count_sum,mask) if flag
-         ary = yield(count_sum, count_accum)
-         ary = NArrayMiss.to_nam_no_dup(ary, mask) unless flag
-       else
--        # すべての要素が欠損値の NArrayMiss を返す
-         na = NArray.new(typecode, *mask.shape)
-         ary = NArrayMiss.to_nam_no_dup(na, false)
-       end
-     else
--      # 有効な要素数があるかチェック
-       if count_sum >= min_count
-         count_accum = NArray.int(*([1]*mask.rank)).fill!(count_sum)
-         ary = yield(count_sum, count_accum)
-       else
--        # 有効な要素数が足りない場合は nil を返す
-         return nil
-       end
-     end
-     return ary
-   end
- 
--    
--  # 引数にオプション (Hash) が指定されているかチェックし、
--  # されている場合は、オプションを取得し戻り値として返す。
--  # 現時点では、オプションは "min_count" のみ
-+
-   def self.check_options(arg, default_mincount)
-     min_count = default_mincount
-     options = %w(min_count)
diff --git a/debian/patches/0001_fix_test_include_NumRu.patch b/debian/patches/0001_fix_test_include_NumRu.patch
new file mode 100644
index 0000000..0d8f58f
--- /dev/null
+++ b/debian/patches/0001_fix_test_include_NumRu.patch
@@ -0,0 +1,20 @@
+From: Debian GIS Project <pkg-grass-devel at lists.alioth.debian.org>
+Date: Sun, 3 Jul 2016 19:23:45 +0900
+Subject: _fix_test_include_NumRu
+
+---
+ test/test_narray_miss.rb | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/test/test_narray_miss.rb b/test/test_narray_miss.rb
+index eda37c7..eee1cf0 100644
+--- a/test/test_narray_miss.rb
++++ b/test/test_narray_miss.rb
+@@ -1,7 +1,6 @@
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
+ require "narray_miss"
+ require "test/unit"
+-include NumRu if defined?(:NumRu)
+ 
+ class NArrayMissTest < Test::Unit::TestCase
+ 
diff --git a/debian/patches/series b/debian/patches/series
index dbf5c4d..4b46321 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-0001-Remove-Non-ASCII-comment.patch
+0001_fix_test_include_NumRu.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/narray-miss.git



More information about the Pkg-grass-devel mailing list