Method: Daru::Maths::Statistics::Vector#rolling
- Defined in:
- lib/daru/maths/statistics/vector.rb
#rolling(function, n = 10) ⇒ Daru::Vector
Calculate the rolling function for a loopback value.
692 693 694 695 696 697 698 699 |
# File 'lib/daru/maths/statistics/vector.rb', line 692 def rolling function, n=10 Daru::Vector.new( [nil] * (n - 1) + (0..(size - n)).map do |i| Daru::Vector.new(@data[i...(i + n)]).send(function) end, index: @index ) end |