All Downloads are FREE. Search and download functionalities are using the official Maven repository.

us.ihmc.math.RootsOfUnity Maven / Gradle / Ivy

There is a newer version: 0.15.1
Show newest version
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