Package elki.math
Class SinCosTable
- java.lang.Object
-
- elki.math.SinCosTable
-
- Direct Known Subclasses:
SinCosTable.FullTable,SinCosTable.HalfTable,SinCosTable.QuarterTable
public abstract class SinCosTable extends java.lang.ObjectClass to precompute / cache Sinus and Cosinus values. Note that the functions use integer offsets, not radians. TODO: add an interpolation function. TODO: add caching- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSinCosTable.FullTableTable that can't exploit much symmetry, because the steps are not divisible by 2.private static classSinCosTable.HalfTableTable that exploits just one symmetry, as the number of steps is divisible by two.private static classSinCosTable.QuarterTableTable that exploits both symmetries, as the number of steps is divisible by four.
-
Field Summary
Fields Modifier and Type Field Description protected intstepsNumber of steps.
-
Constructor Summary
Constructors Modifier Constructor Description privateSinCosTable(int steps)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract doublecos(int step)Get Cosine by step value.static SinCosTablemake(int steps)Make a table for the given number of steps.abstract doublesin(int step)Get Sinus by step value.
-
-
-
Method Detail
-
cos
public abstract double cos(int step)
Get Cosine by step value.- Parameters:
step- Step value- Returns:
- Cosinus
-
sin
public abstract double sin(int step)
Get Sinus by step value.- Parameters:
step- Step value- Returns:
- Sinus
-
make
public static SinCosTable make(int steps)
Make a table for the given number of steps. For step numbers divisible by 4, an optimized implementation will be used.- Parameters:
steps- Number of steps- Returns:
- Table
-
-