|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjsr166z.forkjoin.ParallelDoubleArray
public class ParallelDoubleArray
An array of doubles supporting parallel operations. This class
provides methods supporting the same operations as ParallelArray, but specialized for scalar doubles. It additionally
provides a few methods specific to numerical values.
| Nested Class Summary | |
|---|---|
static class |
ParallelDoubleArray.WithBounds
A restriction of parallel array operations to apply only within a given range of indices. |
static class |
ParallelDoubleArray.WithDoubleMapping
A modifier for parallel array operations to apply to mappings of elements to doubles, not to the elements themselves |
static class |
ParallelDoubleArray.WithFilter
A restriction of parallel array operations to apply only to elements for which a selector returns true |
static class |
ParallelDoubleArray.WithIntMapping
A modifier for parallel array operations to apply to mappings of elements to ints, not to the elements themselves |
static class |
ParallelDoubleArray.WithLongMapping
A modifier for parallel array operations to apply to mappings of elements to longs, not to the elements themselves |
static class |
ParallelDoubleArray.WithMapping<U>
A modifier for parallel array operations to apply to mappings of elements, not to the elements themselves |
| Constructor Summary | |
|---|---|
ParallelDoubleArray(ForkJoinExecutor executor,
double[] handoff)
Creates a new ParallelDoubleArray using the given executor and array. |
|
ParallelDoubleArray(ForkJoinExecutor executor,
int size)
Creates a new ParallelDoubleArray using the given executor and an array of the given size. |
|
ParallelDoubleArray(ForkJoinExecutor executor,
int size,
double[] sourceToCopy)
Creates a new ParallelDoubleArray using the given executor and an array of the given size, initially holding copies of the given source truncated or padded with zero to obtain the specified length. |
|
| Method Summary | ||
|---|---|---|
void |
apply({double=>void} procedure)
Applies the given procedure to elements |
|
ParallelDoubleArray |
combine(double[] other,
{double,double=>double} combiner)
Returns a ParallelArray containing results of applying combine(thisElement, otherElement) for each element. |
|
ParallelDoubleArray |
combine(ParallelDoubleArray other,
{double,double=>double} combiner)
Returns a ParallelArray containing results of applying combine(thisElement, otherElement) for each element. |
|
void |
cumulate({double,double=>double} reducer,
double base)
Replaces each element with the running cumulation of applying the given reducer. |
|
void |
cumulateSum()
Replaces each element with the running sum |
|
double |
get(int i)
Returns the element of the array at the given index |
|
double[] |
getArray()
Returns the underlying array used for computations |
|
ForkJoinExecutor |
getExecutor()
Returns the executor used for computations |
|
int |
indexOfMax()
Returns the index of the greatest element , or -1 if empty assuming that all elements are Comparables |
|
int |
indexOfMax({double,double=>int} comparator)
Returns the index of the greatest element , or -1 if empty |
|
int |
indexOfMin()
Returns the index of the least element , or -1 if empty assuming that all elements are Comparables |
|
int |
indexOfMin({double,double=>int} comparator)
Returns the index of the least element , or -1 if empty |
|
double |
max()
Returns the maximum element, or -Double.MAX_VALUE if empty assuming that all elements are Comparables |
|
double |
max({double,double=>int} comparator)
Returns the maximum element, or -Double.MAX_VALUE if empty |
|
double |
min()
Returns the minimum element, or Double.MAX_VALUE if empty, assuming that all elements are Comparables |
|
double |
min({double,double=>int} comparator)
Returns the minimum element, or Double.MAX_VALUE if empty |
|
ParallelDoubleArray |
newArray()
Returns a new ParallelArray holding elements |
|
double |
precumulate({double,double=>double} reducer,
double base)
Replaces each element with the cumulation of applying the given reducer to all previous values, and returns the total reduction. |
|
double |
precumulateSum()
Replaces each element with its prefix sum |
|
void |
randomFill()
Sets each element to a uniform random value having the same properties as Random.nextDouble() |
|
double |
reduce({double,double=>double} reducer,
double base)
Returns reduction of elements |
|
void |
replaceWithCombination(double[] other,
{double,double=>double} combiner)
Replaces elements with results of applying combine(thisElement, otherElement) |
|
void |
replaceWithCombination(ParallelDoubleArray other,
{double,double=>double} combiner)
Replaces elements with results of applying combine(thisElement, otherElement) |
|
void |
replaceWithGeneratedValue({=>double} generator)
Replaces elements with the results of applying the given generator. |
|
void |
replaceWithMappedIndex({int=>double} mapper)
Replaces elements with the results of applying the given mapper to their indices. |
|
void |
replaceWithTransform({double=>double} mapper)
Replaces elements with the results of applying the given mapper to their current values. |
|
void |
replaceWithValue(double value)
Replaces elements with the given value. |
|
void |
set(int i,
double x)
Sets the element of the array at the given index to the given value |
|
int |
size()
Returns the length of the underlying array |
|
void |
sort()
Sorts the array, using natural comparator. |
|
void |
sort({double,double=>int} comparator)
Sorts the array |
|
double |
sum()
Returns the sum of elements |
|
ParallelDoubleArray.WithBounds |
withBounds(int firstIndex,
int upperBound)
Returns an operation prefix that causes a method to operate only on the elements of the array between firstIndex (inclusive) and upperBound (exclusive). |
|
ParallelDoubleArray.WithFilter |
withFilter({double=>boolean} selector)
Returns an operation prefix that causes a method to operate only on the elements of the array for which the given selector returns true |
|
ParallelDoubleArray.WithDoubleMapping |
withMapping({double=>double} mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper. |
|
ParallelDoubleArray.WithIntMapping |
withMapping({double=>int} mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper. |
|
ParallelDoubleArray.WithLongMapping |
withMapping({double=>long} mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper. |
|
|
withMapping({double=>U} mapper)
Returns an operation prefix that causes a method to operate on mapped elements of the array using the given mapper. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ParallelDoubleArray(ForkJoinExecutor executor,
double[] handoff)
executor - the executorhandoff - the array
public ParallelDoubleArray(ForkJoinExecutor executor,
int size,
double[] sourceToCopy)
executor - the executorsize - the array sizesourceToCopy - the source of initial elements
public ParallelDoubleArray(ForkJoinExecutor executor,
int size)
executor - the executorsize - the array size| Method Detail |
|---|
public ForkJoinExecutor getExecutor()
public double[] getArray()
public int size()
public double get(int i)
i - the index
public void set(int i,
double x)
i - the indexx - the value
public void apply({double=>void} procedure)
procedure - the procedure
public double reduce({double,double=>double} reducer,
double base)
reducer - the reducerbase - the result for an empty array
public ParallelDoubleArray newArray()
public ParallelDoubleArray combine(double[] other,
{double,double=>double} combiner)
other - the other arraycombiner - the combiner
java.lang.ArrayIndexOutOfBoundsException - if other array is
shorter than this array.
public ParallelDoubleArray combine(ParallelDoubleArray other,
{double,double=>double} combiner)
other - the other arraycombiner - the combiner
java.lang.ArrayIndexOutOfBoundsException - if other array is not
the same length as this array.
public void replaceWithTransform({double=>double} mapper)
mapper - the mapper
public void replaceWithMappedIndex({int=>double} mapper)
mapper - the mapper
public void replaceWithGeneratedValue({=>double} generator)
generator - the generatorpublic void randomFill()
Random.nextDouble()
public void replaceWithValue(double value)
value - the value
public void replaceWithCombination(ParallelDoubleArray other,
{double,double=>double} combiner)
other - the other arraycombiner - the combiner
java.lang.ArrayIndexOutOfBoundsException - if other array has
fewer elements than this array.
public void replaceWithCombination(double[] other,
{double,double=>double} combiner)
other - the other arraycombiner - the combiner
java.lang.ArrayIndexOutOfBoundsException - if other array has
fewer elements than this array.
public int indexOfMin({double,double=>int} comparator)
comparator - the comparator
public int indexOfMax({double,double=>int} comparator)
comparator - the comparator
public int indexOfMin()
public int indexOfMax()
public double min({double,double=>int} comparator)
comparator - the comparator
public double min()
public double max({double,double=>int} comparator)
comparator - the comparator
public double max()
public double sum()
public void cumulate({double,double=>double} reducer,
double base)
reducer - the reducerbase - the result for an empty array
public double precumulate({double,double=>double} reducer,
double base)
reducer - the reducerbase - the result for an empty array
public void cumulateSum()
public double precumulateSum()
public void sort({double,double=>int} comparator)
comparator - the comparator to usepublic void sort()
public ParallelDoubleArray.WithBounds withBounds(int firstIndex,
int upperBound)
firstIndex - the lower bound (inclusive)upperBound - the upper bound (exclusive)
public ParallelDoubleArray.WithFilter withFilter({double=>boolean} selector)
selector - the selector
public <U> ParallelDoubleArray.WithMapping<U> withMapping({double=>U} mapper)
mapper - the mapper
public ParallelDoubleArray.WithDoubleMapping withMapping({double=>double} mapper)
mapper - the mapper
public ParallelDoubleArray.WithLongMapping withMapping({double=>long} mapper)
mapper - the mapper
public ParallelDoubleArray.WithIntMapping withMapping({double=>int} mapper)
mapper - the mapper
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||