Class ApproxCos
- java.lang.Object
-
- com.metsci.glimpse.util.math.approx.ApproxCos
-
public class ApproxCos extends Object
Similar to the classes incom.metsci.glimpse.util.math.fast, but uses linear interpolation between samples instead of nearest-neighbor.Anecdotally, speed is about 12x faster than
Math.cos(double). With 100k samples, max error is around 5e-10. Max error decreases as the number of samples increases.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleONE_OVER_TWO_PI
-
Constructor Summary
Constructors Constructor Description ApproxCos(int numSamples)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doublecos(double x_RAD)static doublenormalizeAngleTwoPi(double x_RAD)
-
-
-
Field Detail
-
ONE_OVER_TWO_PI
public static final double ONE_OVER_TWO_PI
- See Also:
- Constant Field Values
-
-