Class PiDistributed.DistributedBinarySplittingPiCalculator

All Implemented Interfaces:
Serializable
Enclosing class:
PiDistributed

protected static class PiDistributed.DistributedBinarySplittingPiCalculator extends PiParallel.ParallelBinarySplittingPiCalculator
Distributed version of the binary splitting algorithm. Uses multiple computers to calculate pi in parallel.
See Also:
  • Field Details

  • Constructor Details

    • DistributedBinarySplittingPiCalculator

      public DistributedBinarySplittingPiCalculator(Pi.BinarySplittingSeries series)
      Construct a distributed pi calculator with the specified precision and radix.
      Parameters:
      series - The binary splitting series to be used.
  • Method Details

    • r

      public void r(long n1, long n2, ApfloatHolder T, ApfloatHolder Q, ApfloatHolder P, ApfloatHolder F, PiDistributed.Node[] nodes) throws ApfloatRuntimeException
      Entry point for the distributed binary splitting algorithm.
      Parameters:
      n1 - Start term.
      n2 - End term.
      T - Algorithm parameter.
      Q - Algorithm parameter.
      P - Algorithm parameter.
      F - Pointer to inverse square root parameter.
      nodes - The operation executors to be used for the calculation.
      Throws:
      ApfloatRuntimeException
    • getNodes

      public PiDistributed.Node[] getNodes()
      Get the available set of operation executor nodes. This implementation returns RemoteOperationExecutors, which execute operations on the cluster's nodes.
      Returns:
      The nodes of the cluster.
    • recombineNodes

      public PiDistributed.Node[] recombineNodes(PiDistributed.Node[] nodes, int numberNeeded)
      Attempt to combine or split nodes to form the needed number of nodes. The returned number of nodes is something between the number of nodes input and the number of nodes requested. The requested number of nodes can be less than or greater than the number of input nodes.
      Parameters:
      nodes - The nodes to recombine.
      numberNeeded - The requested number of nodes.
      Returns:
      The set of recombined nodes.
    • splitNodes

      private Object[] splitNodes(PiDistributed.Node[] nodes)
    • executeAdd

      private Apfloat executeAdd(PiDistributed.Node node, Apfloat x, Apfloat y)