Interface PowerIterator
- All Known Implementing Classes:
PowerNIterator, PowerTwoNIterator, PowerTwoNPlusOneIterator
public interface PowerIterator
Iterator over the powers of a value x.
This API allows to efficiently calculate the various powers of x in a taylor series by storing intermediate results.
For example xn can be calculated using one multiplication by storing the previously calculated xn-1 and x.
getCurrentPower() will be called first to retrieve the initial value.
calculateNextPower() will be called before getCurrentPower().
I do not claim ownership of this code, it is the intellectual property of @obermuhlner.-
Method Summary
Modifier and TypeMethodDescriptionvoidCalculates the next power.Returns the current power.
-
Method Details
-
getCurrentPower
-
calculateNextPower
void calculateNextPower()Calculates the next power.
-