Module: MFilter
- Defined in:
- lib/mfilter.rb
Defined Under Namespace
Classes: Error
Class Method Summary collapse
Class Method Details
.filter(b, a, x, si: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mfilter.rb', line 15 def filter(b, a, x, si: nil) raise TypeError, "b should belong to Array or Numeric class" unless b.is_a? Array or b.is_a? Numeric or b.is_a? Numo::DFloat raise TypeError, "a should belong to Array or Numeric class" unless a.is_a? Array or a.is_a? Numeric or a.is_a? Numo::DFloat raise TypeError, "x should belong to Array class" unless x.is_a? Array or x.is_a? Numo::DFloat raise TypeError, "si should be nil or belong to Array class" unless si.is_a? Array or si.nil? or si.is_a? Numo::DFloat b = [b.to_f] if b.is_a? Numeric a = [a.to_f] if a.is_a? Numeric if b.is_a?(Array) and a.is_a?(Array) and x.is_a?(Array) return _filter(b, a, x, si) end b, a, x = [Numo::DFloat.cast(b), Numo::DFloat.cast(a), Numo::DFloat.cast(x)] si = Numo::DFloat.cast(si) if si if b.is_a?(Numo::DFloat) and a.is_a?(Numo::DFloat) and x.is_a?(Numo::DFloat) return na_filter(b, a, x, si) end end |