This is a question for all the really clever users of advanced Python out there. My input is a series of numbers in a Python numpy array. They are floating point values arranged in a linear sequence. I need to create a new geometric sequence where:
the new first value = the original first value
the new second value = the sum of original values two and three
the new third value = the sum of original values four to seven
the new fourth value = the sum of values eight to fifteen
I can of course do this by looping through the data but I need this processing to be done as quickly as possible - the arrays are huge. What is the fastest way to do this?
example:
12.0, 3.4, 9.2, 7.7, 4.9, 3.8, 6.9
should become:
12.0, 12.6, 23.3