us.ihmc.math.RootsOfUnity Maven / Gradle / Ivy
package us.ihmc.math;
import java.util.ArrayList;
import java.util.List;
/**
* Garbage free implementation for generating the nth roots of unity
*/
public class RootsOfUnity
{
private static final ComplexNumber unity = new ComplexNumber(1.0, 0.0);
private static List rootsOfUnity = new ArrayList<>();
public static List getRootsOfUnity(int orderOfRoots)
{
for(int i = 0; i < orderOfRoots; i++)
rootsOfUnity.add(new ComplexNumber());
unity.getRoots(rootsOfUnity, orderOfRoots);
return rootsOfUnity;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy