Method: NArray#rms
- Defined in:
- lib/narray_ext.rb
#rms(*ranks) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/narray_ext.rb', line 81 def rms(*ranks) if integer? a = self.to_type(NArray::DFLOAT) else a = self end a = NArray.ref(a) n = rank_total(*ranks) if complex? NMath::sqrt( (a.abs**2).sum(*ranks)/n ) else NMath::sqrt( (a**2).sum(*ranks)/n ) end end |