[SCM] narray-miss branch, master, updated. debian/1.2.6-1-3-g30212d4

Youhei SASAKI uwabami at gfd-dennou.org
Sat Nov 24 05:00:35 UTC 2012


The following commit has been merged in the master branch:
commit 30212d4e554584761240e9fe102e2455deca8fd2
Author: Youhei SASAKI <uwabami at gfd-dennou.org>
Date:   Sat Nov 24 12:17:05 2012 +0900

    Add patch: Remove Non-ASCII comment
    
    Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>

diff --git a/debian/changelog b/debian/changelog
index 7bb6a25..f4af92e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
-ruby-narray-miss (1.2.8-1) unstable; urgency=low
+ruby-narray-miss (1.2.8-1) experimental; urgency=low
 
   * Imported Upstream version 1.2.8
   * Bump Standard Version: 3.9.3
   * Update Build-Depends: debhelper >= 9, gemdeb >= 0.3
+  * Add patch: remove non-ASCII comment for generation RD doc.
 
  -- Youhei SASAKI <uwabami at gfd-dennou.org>  Tue, 20 Nov 2012 16:52:28 +0900
 
diff --git a/debian/patches/0001-Remove-Non-ASCII-comment.patch b/debian/patches/0001-Remove-Non-ASCII-comment.patch
new file mode 100644
index 0000000..338efc4
--- /dev/null
+++ b/debian/patches/0001-Remove-Non-ASCII-comment.patch
@@ -0,0 +1,185 @@
+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/series b/debian/patches/series
new file mode 100644
index 0000000..dbf5c4d
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Remove-Non-ASCII-comment.patch

-- 
Additional Ruby Class handling missing value



More information about the Pkg-grass-devel mailing list