Package org.ojalgo.array
Class ArrayAnyD<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.array.ArrayAnyD<N>
-
- All Implemented Interfaces:
java.util.function.Consumer<AccessAnyD<?>>
,Access1D<N>
,Access1D.Aggregatable<N>
,Access1D.Sliceable<N>
,Access1D.Visitable<N>
,AccessAnyD<N>
,AccessAnyD.Aggregatable<N>
,AccessAnyD.Collectable<N,MutateAnyD>
,AccessAnyD.Sliceable<N>
,AccessAnyD.Visitable<N>
,FactoryAnyD.Builder<ArrayAnyD<N>>
,Mutate1D
,Mutate1D.Fillable<N>
,Mutate1D.Mixable<N>
,Mutate1D.Modifiable<N>
,MutateAnyD
,MutateAnyD.Fillable<N>
,MutateAnyD.Mixable<N>
,MutateAnyD.Modifiable<N>
,MutateAnyD.ModifiableReceiver<N>
,MutateAnyD.Receiver<N>
,Structure1D
,StructureAnyD
,StructureAnyD.ReducibleTo1D<Array1D<N>>
,StructureAnyD.ReducibleTo2D<Array2D<N>>
,StructureAnyD.Reshapable
public final class ArrayAnyD<N extends java.lang.Comparable<N>> extends java.lang.Object implements AccessAnyD.Visitable<N>, AccessAnyD.Aggregatable<N>, AccessAnyD.Sliceable<N>, StructureAnyD.ReducibleTo1D<Array1D<N>>, StructureAnyD.ReducibleTo2D<Array2D<N>>, AccessAnyD.Collectable<N,MutateAnyD>, MutateAnyD.ModifiableReceiver<N>, MutateAnyD.Mixable<N>, StructureAnyD.Reshapable, FactoryAnyD.Builder<ArrayAnyD<N>>
ArrayAnyD
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ArrayAnyD.Factory<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.AccessAnyD
AccessAnyD.Aggregatable<N extends java.lang.Comparable<N>>, AccessAnyD.Collectable<N extends java.lang.Comparable<N>,R extends MutateAnyD>, AccessAnyD.ElementView<N extends java.lang.Comparable<N>>, AccessAnyD.MatrixView<N extends java.lang.Comparable<N>>, AccessAnyD.SelectionView<N extends java.lang.Comparable<N>>, AccessAnyD.Sliceable<N extends java.lang.Comparable<N>>, AccessAnyD.VectorView<N extends java.lang.Comparable<N>>, AccessAnyD.Visitable<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Mutate1D
Mutate1D.Fillable<N extends java.lang.Comparable<N>>, Mutate1D.Mixable<N extends java.lang.Comparable<N>>, Mutate1D.Modifiable<N extends java.lang.Comparable<N>>, Mutate1D.ModifiableReceiver<N extends java.lang.Comparable<N>>, Mutate1D.Receiver<N extends java.lang.Comparable<N>>, Mutate1D.Sortable
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.MutateAnyD
MutateAnyD.Fillable<N extends java.lang.Comparable<N>>, MutateAnyD.Mixable<N extends java.lang.Comparable<N>>, MutateAnyD.Modifiable<N extends java.lang.Comparable<N>>, MutateAnyD.ModifiableReceiver<N extends java.lang.Comparable<N>>, MutateAnyD.Receiver<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,B extends Structure1D.Logical<S,B>>, Structure1D.LongIndex, Structure1D.LoopCallback
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.StructureAnyD
StructureAnyD.IntReference, StructureAnyD.Logical<S extends StructureAnyD,B extends StructureAnyD.Logical<S,B>>, StructureAnyD.LongReference, StructureAnyD.ReducibleTo1D<R extends Structure1D>, StructureAnyD.ReducibleTo2D<R extends Structure2D>, StructureAnyD.ReferenceCallback, StructureAnyD.ReferenceMapper, StructureAnyD.Reshapable
-
-
Field Summary
Fields Modifier and Type Field Description static ArrayAnyD.Factory<ComplexNumber>
C128
static ArrayAnyD.Factory<Quaternion>
H256
private BasicArray<N>
myDelegate
private long[]
myStructure
static ArrayAnyD.Factory<RationalNumber>
Q128
static ArrayAnyD.Factory<java.lang.Double>
R032
static ArrayAnyD.Factory<java.lang.Double>
R064
static ArrayAnyD.Factory<Quadruple>
R128
static ArrayAnyD.Factory<java.math.BigDecimal>
R256
static ArrayAnyD.Factory<java.lang.Double>
Z008
static ArrayAnyD.Factory<java.lang.Double>
Z016
static ArrayAnyD.Factory<java.lang.Double>
Z032
static ArrayAnyD.Factory<java.lang.Double>
Z064
-
Constructor Summary
Constructors Modifier Constructor Description private
ArrayAnyD()
(package private)
ArrayAnyD(BasicArray<N> delegate, long[] structure)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(long[] reference, byte addend)
void
add(long[] reference, double addend)
void
add(long[] reference, float addend)
void
add(long[] reference, int addend)
void
add(long[] reference, long addend)
void
add(long[] reference, short addend)
void
add(long[] reference, java.lang.Comparable<?> addend)
void
add(long index, byte addend)
void
add(long index, double addend)
void
add(long index, float addend)
void
add(long index, int addend)
void
add(long index, long addend)
void
add(long index, short addend)
void
add(long index, java.lang.Comparable<?> addend)
N
aggregateRange(long first, long limit, Aggregator aggregator)
N
aggregateSet(int dimension, long dimensionalIndex, Aggregator aggregator)
N
aggregateSet(long[] initial, int dimension, Aggregator aggregator)
ArrayAnyD<N>
build()
byte
byteValue(int index)
byte
byteValue(long index)
byte
byteValue(long... ref)
long
count()
The total number of elements in this structure.long
count(int dimension)
count() == count(0) * count(1) * count(2) * count(3) * ...double
doubleValue(int index)
double
doubleValue(long index)
double
doubleValue(long... ref)
boolean
equals(java.lang.Object obj)
ArrayAnyD<N>
expand(int rank)
If necessary increase the rank to the specified number (without changing the total number of components)(package private) FactoryAnyD<ArrayAnyD<N>>
factory()
static <N extends java.lang.Comparable<N>>
ArrayAnyD.Factory<N>factory(DenseArray.Factory<N> denseArray)
void
fillAll(N value)
void
fillAll(NullaryFunction<?> supplier)
void
fillRange(long first, long limit, N value)
void
fillRange(long first, long limit, NullaryFunction<?> supplier)
void
fillSet(int dimension, long dimensionalIndex, N value)
void
fillSet(int dimension, long dimensionalIndex, NullaryFunction<?> supplier)
void
fillSet(long[] initial, int dimension, N value)
void
fillSet(long[] initial, int dimension, NullaryFunction<?> supplier)
Array1D<N>
flatten()
Flattens this abitrary dimensional array to a one dimensional array.float
floatValue(int index)
float
floatValue(long index)
float
floatValue(long... ref)
N
get(long index)
N
get(long... ref)
(package private) BasicArray<N>
getDelegate()
int
hashCode()
long
indexOfLargest()
int
intValue(int index)
int
intValue(long index)
int
intValue(long... ref)
long
longValue(int index)
long
longValue(long index)
long
longValue(long... ref)
double
mix(long[] reference, BinaryFunction<N> mixer, double addend)
N
mix(long[] reference, BinaryFunction<N> mixer, N addend)
void
modifyAll(UnaryFunction<N> modifier)
void
modifyAny(TransformationAnyD<N> modifier)
void
modifyMatching(BinaryFunction<N> function, Access1D<N> right)
void
modifyMatching(Access1D<N> left, BinaryFunction<N> function)
void
modifyOne(long[] reference, UnaryFunction<N> modifier)
void
modifyOne(long index, UnaryFunction<N> modifier)
void
modifyRange(long first, long limit, UnaryFunction<N> modifier)
void
modifySet(int dimension, long dimensionalIndex, UnaryFunction<N> modifier)
void
modifySet(long[] initial, int dimension, UnaryFunction<N> modifier)
int
rank()
Array2D<N>
reduce(int rowDim, int colDim, Aggregator aggregator)
Array1D<N>
reduce(int dimension, Aggregator aggregator)
void
reset()
Reset this mutable structure to some standard (all zeros) initial state.ArrayAnyD<N>
reshape(long... shape)
The same array viewed/accessed with a different shapevoid
set(int index, byte value)
void
set(int index, double value)
void
set(int index, float value)
void
set(int index, int value)
void
set(int index, long value)
void
set(int index, short value)
void
set(long[] reference, byte value)
void
set(long[] reference, double value)
void
set(long[] reference, float value)
void
set(long[] reference, int value)
void
set(long[] reference, long value)
void
set(long[] reference, short value)
void
set(long[] reference, java.lang.Comparable<?> value)
void
set(long index, byte value)
void
set(long index, double value)
void
set(long index, float value)
void
set(long index, int value)
void
set(long index, long value)
void
set(long index, short value)
void
set(long index, java.lang.Comparable<?> value)
long[]
shape()
short
shortValue(int index)
short
shortValue(long index)
short
shortValue(long... ref)
int
size()
The total number of elements in this structure.int
size(int dimension)
Array1D<N>
sliceRange(long first, long limit)
Array1D<N>
sliceSet(long[] initial, int dimension)
If the intial reference is {0, 2, 3} and the slice dimension is 1 then the sliced 1D view will map to the following elements in the AnyD data structure:ArrayAnyD<N>
squeeze()
Squeezing removes the dimensions or axes that have a length of one.void
supplyTo(MutateAnyD receiver)
java.lang.String
toString()
void
visitAll(VoidFunction<N> visitor)
void
visitOne(long[] reference, VoidFunction<N> visitor)
void
visitOne(long index, VoidFunction<N> visitor)
void
visitRange(long first, long limit, VoidFunction<N> visitor)
void
visitSet(int dimension, long dimensionalIndex, VoidFunction<N> visitor)
void
visitSet(long[] initial, int dimension, VoidFunction<N> visitor)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ojalgo.structure.Access1D
asCollectable1D, asKeyed1D, axpy, dot, nonzeros, select, supplyTo, toRawCopy1D
-
Methods inherited from interface org.ojalgo.structure.Access1D.Aggregatable
aggregateAll
-
Methods inherited from interface org.ojalgo.structure.AccessAnyD
asCollectableAnyD, byteValue, doubleValue, elements, floatValue, get, intValue, longValue, matrices, select, shortValue, vectors
-
Methods inherited from interface org.ojalgo.structure.AccessAnyD.Aggregatable
reduce
-
Methods inherited from interface org.ojalgo.structure.AccessAnyD.Collectable
collect
-
Methods inherited from interface org.ojalgo.structure.Mutate1D.Fillable
fillCompatible, fillMatching, fillMatching, fillMatching
-
Methods inherited from interface org.ojalgo.structure.MutateAnyD.Fillable
fillCompatible
-
Methods inherited from interface org.ojalgo.structure.MutateAnyD.Mixable
mix, mix
-
Methods inherited from interface org.ojalgo.structure.MutateAnyD.ModifiableReceiver
modifyCompatible, modifyCompatible
-
Methods inherited from interface org.ojalgo.structure.MutateAnyD.Receiver
accept, isAcceptable
-
Methods inherited from interface org.ojalgo.structure.StructureAnyD
loop, loop, loopAllReferences, loopReferences
-
-
-
-
Field Detail
-
C128
public static final ArrayAnyD.Factory<ComplexNumber> C128
-
H256
public static final ArrayAnyD.Factory<Quaternion> H256
-
Q128
public static final ArrayAnyD.Factory<RationalNumber> Q128
-
R032
public static final ArrayAnyD.Factory<java.lang.Double> R032
-
R064
public static final ArrayAnyD.Factory<java.lang.Double> R064
-
R128
public static final ArrayAnyD.Factory<Quadruple> R128
-
R256
public static final ArrayAnyD.Factory<java.math.BigDecimal> R256
-
Z008
public static final ArrayAnyD.Factory<java.lang.Double> Z008
-
Z016
public static final ArrayAnyD.Factory<java.lang.Double> Z016
-
Z032
public static final ArrayAnyD.Factory<java.lang.Double> Z032
-
Z064
public static final ArrayAnyD.Factory<java.lang.Double> Z064
-
myDelegate
private final BasicArray<N extends java.lang.Comparable<N>> myDelegate
-
myStructure
private final long[] myStructure
-
-
Constructor Detail
-
ArrayAnyD
private ArrayAnyD()
-
ArrayAnyD
ArrayAnyD(BasicArray<N> delegate, long[] structure)
-
-
Method Detail
-
factory
public static <N extends java.lang.Comparable<N>> ArrayAnyD.Factory<N> factory(DenseArray.Factory<N> denseArray)
-
add
public void add(long index, byte addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, java.lang.Comparable<?> addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, double addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, float addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, int addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, long addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long index, short addend)
- Specified by:
add
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long[] reference, byte addend)
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long[] reference, java.lang.Comparable<?> addend)
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long[] reference, double addend)
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long[] reference, float addend)
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long[] reference, int addend)
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long[] reference, long addend)
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
add
public void add(long[] reference, short addend)
- Specified by:
add
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
aggregateRange
public N aggregateRange(long first, long limit, Aggregator aggregator)
- Specified by:
aggregateRange
in interfaceAccess1D.Aggregatable<N extends java.lang.Comparable<N>>
-
aggregateSet
public N aggregateSet(int dimension, long dimensionalIndex, Aggregator aggregator)
- Specified by:
aggregateSet
in interfaceAccessAnyD.Aggregatable<N extends java.lang.Comparable<N>>
-
aggregateSet
public N aggregateSet(long[] initial, int dimension, Aggregator aggregator)
- Specified by:
aggregateSet
in interfaceAccessAnyD.Aggregatable<N extends java.lang.Comparable<N>>
-
build
public ArrayAnyD<N> build()
- Specified by:
build
in interfaceFactoryAnyD.Builder<N extends java.lang.Comparable<N>>
-
byteValue
public byte byteValue(int index)
-
byteValue
public byte byteValue(long index)
-
byteValue
public byte byteValue(long... ref)
- Specified by:
byteValue
in interfaceAccessAnyD<N extends java.lang.Comparable<N>>
-
count
public long count()
Description copied from interface:Structure1D
The total number of elements in this structure.You only need to implement this method if the structure can contain more than Integer.MAX_VALUE elements.
- Specified by:
count
in interfaceStructure1D
-
count
public long count(int dimension)
Description copied from interface:StructureAnyD
count() == count(0) * count(1) * count(2) * count(3) * ...- Specified by:
count
in interfaceStructureAnyD
-
doubleValue
public double doubleValue(int index)
- Specified by:
doubleValue
in interfaceAccess1D<N extends java.lang.Comparable<N>>
-
doubleValue
public double doubleValue(long index)
- Specified by:
doubleValue
in interfaceAccess1D<N extends java.lang.Comparable<N>>
-
doubleValue
public double doubleValue(long... ref)
- Specified by:
doubleValue
in interfaceAccessAnyD<N extends java.lang.Comparable<N>>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
expand
public ArrayAnyD<N> expand(int rank)
Description copied from interface:StructureAnyD.Reshapable
If necessary increase the rank to the specified number (without changing the total number of components)- Specified by:
expand
in interfaceStructureAnyD.Reshapable
-
fillAll
public void fillAll(N value)
- Specified by:
fillAll
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillAll
public void fillAll(NullaryFunction<?> supplier)
- Specified by:
fillAll
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillRange
public void fillRange(long first, long limit, N value)
- Specified by:
fillRange
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillRange
public void fillRange(long first, long limit, NullaryFunction<?> supplier)
- Specified by:
fillRange
in interfaceMutate1D.Fillable<N extends java.lang.Comparable<N>>
-
fillSet
public void fillSet(int dimension, long dimensionalIndex, N value)
- Specified by:
fillSet
in interfaceMutateAnyD.Fillable<N extends java.lang.Comparable<N>>
-
fillSet
public void fillSet(int dimension, long dimensionalIndex, NullaryFunction<?> supplier)
- Specified by:
fillSet
in interfaceMutateAnyD.Fillable<N extends java.lang.Comparable<N>>
-
fillSet
public void fillSet(long[] initial, int dimension, N value)
- Specified by:
fillSet
in interfaceMutateAnyD.Fillable<N extends java.lang.Comparable<N>>
-
fillSet
public void fillSet(long[] initial, int dimension, NullaryFunction<?> supplier)
- Specified by:
fillSet
in interfaceMutateAnyD.Fillable<N extends java.lang.Comparable<N>>
-
flatten
public Array1D<N> flatten()
Flattens this abitrary dimensional array to a one dimensional array. The (internal/actual) array is not copied, it is just accessed through a different adaptor.- Specified by:
flatten
in interfaceStructureAnyD.Reshapable
- See Also:
StructureAnyD.Reshapable.flatten()
-
floatValue
public float floatValue(int index)
- Specified by:
floatValue
in interfaceAccess1D<N extends java.lang.Comparable<N>>
-
floatValue
public float floatValue(long index)
- Specified by:
floatValue
in interfaceAccess1D<N extends java.lang.Comparable<N>>
-
floatValue
public float floatValue(long... ref)
- Specified by:
floatValue
in interfaceAccessAnyD<N extends java.lang.Comparable<N>>
-
get
public N get(long index)
-
get
public N get(long... ref)
- Specified by:
get
in interfaceAccessAnyD<N extends java.lang.Comparable<N>>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
indexOfLargest
public long indexOfLargest()
- Specified by:
indexOfLargest
in interfaceAccess1D.Aggregatable<N extends java.lang.Comparable<N>>
-
intValue
public int intValue(int index)
-
intValue
public int intValue(long index)
-
intValue
public int intValue(long... ref)
- Specified by:
intValue
in interfaceAccessAnyD<N extends java.lang.Comparable<N>>
-
longValue
public long longValue(int index)
-
longValue
public long longValue(long index)
-
longValue
public long longValue(long... ref)
- Specified by:
longValue
in interfaceAccessAnyD<N extends java.lang.Comparable<N>>
-
mix
public double mix(long[] reference, BinaryFunction<N> mixer, double addend)
- Specified by:
mix
in interfaceMutateAnyD.Mixable<N extends java.lang.Comparable<N>>
-
mix
public N mix(long[] reference, BinaryFunction<N> mixer, N addend)
- Specified by:
mix
in interfaceMutateAnyD.Mixable<N extends java.lang.Comparable<N>>
-
modifyAll
public void modifyAll(UnaryFunction<N> modifier)
- Specified by:
modifyAll
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyAny
public void modifyAny(TransformationAnyD<N> modifier)
- Specified by:
modifyAny
in interfaceMutateAnyD.ModifiableReceiver<N extends java.lang.Comparable<N>>
-
modifyMatching
public void modifyMatching(Access1D<N> left, BinaryFunction<N> function)
- Specified by:
modifyMatching
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyMatching
public void modifyMatching(BinaryFunction<N> function, Access1D<N> right)
- Specified by:
modifyMatching
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyOne
public void modifyOne(long index, UnaryFunction<N> modifier)
- Specified by:
modifyOne
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifyOne
public void modifyOne(long[] reference, UnaryFunction<N> modifier)
- Specified by:
modifyOne
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
modifyRange
public void modifyRange(long first, long limit, UnaryFunction<N> modifier)
- Specified by:
modifyRange
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
modifySet
public void modifySet(int dimension, long dimensionalIndex, UnaryFunction<N> modifier)
- Specified by:
modifySet
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
modifySet
public void modifySet(long[] initial, int dimension, UnaryFunction<N> modifier)
- Specified by:
modifySet
in interfaceMutateAnyD.Modifiable<N extends java.lang.Comparable<N>>
-
rank
public int rank()
- Specified by:
rank
in interfaceStructureAnyD
- Returns:
- The number of dimensions (the number of indices used to reference one element)
-
reduce
public Array1D<N> reduce(int dimension, Aggregator aggregator)
- Specified by:
reduce
in interfaceStructureAnyD.ReducibleTo1D<N extends java.lang.Comparable<N>>
- Parameters:
dimension
- Which of the AnyD-dimensions should be mapped to the resulting 1D structure.aggregator
- How to aggregate the values of the reduction- Returns:
- A 1D data structure with aggregated values
-
reduce
public Array2D<N> reduce(int rowDim, int colDim, Aggregator aggregator)
- Specified by:
reduce
in interfaceStructureAnyD.ReducibleTo2D<N extends java.lang.Comparable<N>>
- Parameters:
rowDim
- Which of the AnyD-dimensions should be mapped to the rows of the resulting 2D structure.colDim
- Which of the AnyD-dimensions should be mapped to the columns of the resulting 2D structure.aggregator
- How to aggregate the values of the reduction- Returns:
- A 2D data structure with aggregated values
-
reset
public void reset()
Description copied from interface:Mutate1D
Reset this mutable structure to some standard (all zeros) initial state. It must still be usuable after this call, and the structure/size/shape must not change.
-
reshape
public ArrayAnyD<N> reshape(long... shape)
Description copied from interface:StructureAnyD.Reshapable
The same array viewed/accessed with a different shape- Specified by:
reshape
in interfaceStructureAnyD.Reshapable
-
set
public void set(long index, java.lang.Comparable<?> value)
-
set
public void set(long[] reference, byte value)
- Specified by:
set
in interfaceMutateAnyD
-
set
public void set(long[] reference, java.lang.Comparable<?> value)
- Specified by:
set
in interfaceMutateAnyD
-
set
public void set(long[] reference, double value)
- Specified by:
set
in interfaceMutateAnyD
-
set
public void set(long[] reference, float value)
- Specified by:
set
in interfaceMutateAnyD
-
set
public void set(long[] reference, int value)
- Specified by:
set
in interfaceMutateAnyD
-
set
public void set(long[] reference, long value)
- Specified by:
set
in interfaceMutateAnyD
-
set
public void set(long[] reference, short value)
- Specified by:
set
in interfaceMutateAnyD
-
shape
public long[] shape()
- Specified by:
shape
in interfaceStructureAnyD
-
shortValue
public short shortValue(int index)
- Specified by:
shortValue
in interfaceAccess1D<N extends java.lang.Comparable<N>>
-
shortValue
public short shortValue(long index)
- Specified by:
shortValue
in interfaceAccess1D<N extends java.lang.Comparable<N>>
-
shortValue
public short shortValue(long... ref)
- Specified by:
shortValue
in interfaceAccessAnyD<N extends java.lang.Comparable<N>>
-
size
public int size()
Description copied from interface:Structure1D
The total number of elements in this structure.- Specified by:
size
in interfaceStructure1D
-
size
public int size(int dimension)
- Specified by:
size
in interfaceStructureAnyD
-
sliceRange
public Array1D<N> sliceRange(long first, long limit)
- Specified by:
sliceRange
in interfaceAccess1D.Sliceable<N extends java.lang.Comparable<N>>
-
sliceSet
public Array1D<N> sliceSet(long[] initial, int dimension)
Description copied from interface:AccessAnyD.Sliceable
If the intial reference is {0, 2, 3} and the slice dimension is 1 then the sliced 1D view will map to the following elements in the AnyD data structure:0 => {0, 2, 3} 1 => {0, 3, 3} 2 => {0, 4, 3} 3 => {0, 5, 3} 4 => {0, 6, 3} 5 => {0, 7, 3} 6 => ...
Meaning the row index is always '0', and the plane/matrix/area index is always '3', but the column index starts at '2' and then increments.If you have a data structure defined as 3 x 3 x n (that is n 3x3 matrices) and you want to access the second element of the first column of each of the matrices, then the intial refrence is {1, 0, 0} and the slice dimension is 2.
- Specified by:
sliceSet
in interfaceAccessAnyD.Sliceable<N extends java.lang.Comparable<N>>
- Parameters:
initial
- Indices pointing to what will be the first element of the slicedAccess1D
dimension
- Which indices that make out an element reference should be incremented- Returns:
- A sliced 1D view of the underlying AnyD data structure
-
squeeze
public ArrayAnyD<N> squeeze()
Description copied from interface:StructureAnyD.Reshapable
Squeezing removes the dimensions or axes that have a length of one. (This does not change the total number of components.)- Specified by:
squeeze
in interfaceStructureAnyD.Reshapable
-
supplyTo
public void supplyTo(MutateAnyD receiver)
- Specified by:
supplyTo
in interfaceAccessAnyD.Collectable<N extends java.lang.Comparable<N>,MutateAnyD>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
visitAll
public void visitAll(VoidFunction<N> visitor)
- Specified by:
visitAll
in interfaceAccess1D.Visitable<N extends java.lang.Comparable<N>>
-
visitOne
public void visitOne(long index, VoidFunction<N> visitor)
- Specified by:
visitOne
in interfaceAccess1D.Visitable<N extends java.lang.Comparable<N>>
-
visitOne
public void visitOne(long[] reference, VoidFunction<N> visitor)
- Specified by:
visitOne
in interfaceAccessAnyD.Visitable<N extends java.lang.Comparable<N>>
-
visitRange
public void visitRange(long first, long limit, VoidFunction<N> visitor)
- Specified by:
visitRange
in interfaceAccess1D.Visitable<N extends java.lang.Comparable<N>>
-
visitSet
public void visitSet(int dimension, long dimensionalIndex, VoidFunction<N> visitor)
- Specified by:
visitSet
in interfaceAccessAnyD.Visitable<N extends java.lang.Comparable<N>>
-
visitSet
public void visitSet(long[] initial, int dimension, VoidFunction<N> visitor)
- Specified by:
visitSet
in interfaceAccessAnyD.Visitable<N extends java.lang.Comparable<N>>
-
factory
FactoryAnyD<ArrayAnyD<N>> factory()
-
getDelegate
BasicArray<N> getDelegate()
-
-