# Class PiDistributed.DistributedBinarySplittingPiCalculator

java.lang.Object
org.apfloat.samples.Pi.BinarySplittingPiCalculator
org.apfloat.samples.PiParallel.ParallelBinarySplittingPiCalculator
org.apfloat.samples.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.

Version:
  1.9.0
Author:
  Mikko Tommila
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DistributedBinarySplittingPiCalculator(Pi.BinarySplittingSeries series)`
  Construct a distributed pi calculator with the specified precision and radix.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PiDistributed.Node[]`
  `getNodes()`
  Get the available set of operation executor nodes.
  `void`
  `r(long n1, long n2, ApfloatHolder T, ApfloatHolder Q, ApfloatHolder P, ApfloatHolder F, PiDistributed.Node[] nodes)`
  Entry point for the distributed binary splitting algorithm.
  `PiDistributed.Node[]`
  `recombineNodes(PiDistributed.Node[] nodes, int numberNeeded)`
  Attempt to combine or split nodes to form the needed number of nodes.

  ### Methods inherited from class PiParallel.ParallelBinarySplittingPiCalculator

  `r`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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 `RemoteOperationExecutor`s, 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.