Class ArrayAnyD<N extends Comparable<N>>
java.lang.Object
org.ojalgo.array.ArrayAnyD<N>
- All Implemented Interfaces:
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 Comparable<N>>
extends 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 ClassesNested classes/interfaces inherited from interface AccessAnyD
AccessAnyD.Aggregatable<N>, AccessAnyD.Collectable<N,R>, AccessAnyD.ElementView<N>, AccessAnyD.MatrixView<N>, AccessAnyD.SelectionView<N>, AccessAnyD.Sliceable<N>, AccessAnyD.VectorView<N>, AccessAnyD.Visitable<N> Nested classes/interfaces inherited from interface Mutate1D
Mutate1D.Fillable<N>, Mutate1D.Mixable<N>, Mutate1D.Modifiable<N>, Mutate1D.ModifiableReceiver<N>, Mutate1D.Receiver<N>, Mutate1D.SortableNested classes/interfaces inherited from interface MutateAnyD
MutateAnyD.Fillable<N>, MutateAnyD.Mixable<N>, MutateAnyD.Modifiable<N>, MutateAnyD.ModifiableReceiver<N>, MutateAnyD.Receiver<N>Nested classes/interfaces inherited from interface Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S,B>, Structure1D.LongIndex, Structure1D.LoopCallback Nested classes/interfaces inherited from interface StructureAnyD
StructureAnyD.IntReference, StructureAnyD.Logical<S,B>, StructureAnyD.LongReference, StructureAnyD.ReducibleTo1D<R>, StructureAnyD.ReducibleTo2D<R>, StructureAnyD.ReferenceCallback, StructureAnyD.ReferenceMapper, StructureAnyD.Reshapable -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ArrayAnyD.Factory<ComplexNumber> static final ArrayAnyD.Factory<Quaternion> private final BasicArray<N> private final long[]static final ArrayAnyD.Factory<RationalNumber> static final ArrayAnyD.Factory<Double> static final ArrayAnyD.Factory<Double> static final ArrayAnyD.Factory<Quadruple> static final ArrayAnyD.Factory<BigDecimal> static final ArrayAnyD.Factory<Double> static final ArrayAnyD.Factory<Double> static final ArrayAnyD.Factory<Double> static final ArrayAnyD.Factory<Double> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate(package private)ArrayAnyD(BasicArray<N> delegate, long[] structure) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int index, double addend) voidadd(long[] reference, byte addend) voidadd(long[] reference, double addend) voidadd(long[] reference, float addend) voidadd(long[] reference, int addend) voidadd(long[] reference, long addend) voidadd(long[] reference, short addend) voidadd(long[] reference, Comparable<?> addend) voidadd(long index, byte addend) voidadd(long index, double addend) voidadd(long index, float addend) voidadd(long index, int addend) voidadd(long index, long addend) voidadd(long index, short addend) voidadd(long index, Comparable<?> addend) aggregateRange(long first, long limit, Aggregator aggregator) aggregateSet(int dimension, long dimensionalIndex, Aggregator aggregator) aggregateSet(long[] initial, int dimension, Aggregator aggregator) build()bytebyteValue(int index) bytebyteValue(long index) bytebyteValue(long... ref) longcount()The total number of elements in this structure.longcount(int dimension) count() == count(0) * count(1) * count(2) * count(3) * ...doubledoubleValue(int index) doubledoubleValue(long index) doubledoubleValue(long... ref) booleanexpand(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 Comparable<N>>
ArrayAnyD.Factory<N> factory(DenseArray.Factory<N, ?> denseArray) voidvoidfillAll(NullaryFunction<?> supplier) voidvoidfillRange(long first, long limit, NullaryFunction<?> supplier) voidvoidfillSet(int dimension, long dimensionalIndex, NullaryFunction<?> supplier) voidvoidfillSet(long[] initial, int dimension, NullaryFunction<?> supplier) flatten()Flattens this abitrary dimensional array to a one dimensional array.floatfloatValue(int index) floatfloatValue(long index) floatfloatValue(long... ref) get(long index) get(long... ref) (package private) BasicArray<N> inthashCode()longintintValue(int index) intintValue(long index) intintValue(long... ref) longlongValue(int index) longlongValue(long index) longlongValue(long... ref) doublemix(long[] reference, BinaryFunction<N> mixer, double addend) mix(long[] reference, BinaryFunction<N> mixer, N addend) voidmodifyAll(UnaryFunction<N> modifier) voidmodifyAny(TransformationAnyD<N> modifier) voidmodifyMatching(BinaryFunction<N> function, Access1D<N> right) voidmodifyMatching(Access1D<N> left, BinaryFunction<N> function) voidmodifyOne(long[] reference, UnaryFunction<N> modifier) voidmodifyOne(long index, UnaryFunction<N> modifier) voidmodifyRange(long first, long limit, UnaryFunction<N> modifier) voidmodifySet(int dimension, long dimensionalIndex, UnaryFunction<N> modifier) voidmodifySet(long[] initial, int dimension, UnaryFunction<N> modifier) intrank()reduce(int rowDim, int colDim, Aggregator aggregator) reduce(int dimension, Aggregator aggregator) voidreset()Reset this mutable structure to some standard (all zeros) initial state.reshape(long... shape) The same array viewed/accessed with a different shapevoidset(int index, byte value) voidset(int index, double value) voidset(int index, float value) voidset(int index, int value) voidset(int index, long value) voidset(int index, short value) voidset(long[] reference, byte value) voidset(long[] reference, double value) voidset(long[] reference, float value) voidset(long[] reference, int value) voidset(long[] reference, long value) voidset(long[] reference, short value) voidset(long[] reference, Comparable<?> value) voidset(long index, byte value) voidset(long index, double value) voidset(long index, float value) voidset(long index, int value) voidset(long index, long value) voidset(long index, short value) voidset(long index, Comparable<?> value) long[]shape()shortshortValue(int index) shortshortValue(long index) shortshortValue(long... ref) intsize()The total number of elements in this structure.intsize(int dimension) sliceRange(long first, long limit) 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:squeeze()Squeezing removes the dimensions or axes that have a length of one.voidsupplyTo(MutateAnyD receiver) toString()voidvisitAll(VoidFunction<N> visitor) voidvisitOne(long[] reference, VoidFunction<N> visitor) voidvisitOne(long index, VoidFunction<N> visitor) voidvisitRange(long first, long limit, VoidFunction<N> visitor) voidvisitSet(int dimension, long dimensionalIndex, VoidFunction<N> visitor) voidvisitSet(long[] initial, int dimension, VoidFunction<N> visitor) Methods inherited from interface Access1D
asCollectable1D, asKeyed1D, asList, axpy, dot, nonzeros, select, supplyTo, toList, toRawCopy1DMethods inherited from interface Access1D.Aggregatable
aggregateAllMethods inherited from interface AccessAnyD
asCollectableAnyD, byteValue, doubleValue, elements, floatValue, get, intValue, longValue, matrices, select, shortValue, vectorsMethods inherited from interface AccessAnyD.Aggregatable
reduceMethods inherited from interface AccessAnyD.Collectable
collectMethods inherited from interface Mutate1D.Fillable
fillCompatible, fillMatching, fillMatching, fillMatching, fillMatchingMethods inherited from interface MutateAnyD.Fillable
fillCompatibleMethods inherited from interface MutateAnyD.Mixable
mix, mixMethods inherited from interface MutateAnyD.ModifiableReceiver
modifyCompatible, modifyCompatibleMethods inherited from interface MutateAnyD.Receiver
accept, isAcceptableMethods inherited from interface StructureAnyD
loop, loop, loopAllReferences, loopReferences
-
Field Details
-
C128
-
H256
-
Q128
-
R032
-
R064
-
R128
-
R256
-
Z008
-
Z016
-
Z032
-
Z064
-
myDelegate
-
myStructure
private final long[] myStructure
-
-
Constructor Details
-
ArrayAnyD
private ArrayAnyD() -
ArrayAnyD
ArrayAnyD(BasicArray<N> delegate, long[] structure)
-
-
Method Details
-
factory
public static <N extends Comparable<N>> ArrayAnyD.Factory<N> factory(DenseArray.Factory<N, ?> denseArray) -
add
public void add(int index, double addend) - Specified by:
addin interfaceMutate1D.Modifiable<N extends Comparable<N>>- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long index, byte addend) - Specified by:
addin interfaceMutate1D.Modifiable<N extends Comparable<N>>- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
- Specified by:
addin interfaceMutate1D.Modifiable<N extends Comparable<N>>- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long index, double addend) - Specified by:
addin interfaceMutate1D.Modifiable<N extends Comparable<N>>- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long index, float addend) - Specified by:
addin interfaceMutate1D.Modifiable<N extends Comparable<N>>- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long index, int addend) - Specified by:
addin interfaceMutate1D.Modifiable<N extends Comparable<N>>- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long index, long addend) - Specified by:
addin interfaceMutate1D.Modifiable<N extends Comparable<N>>- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long index, short addend) - Specified by:
addin interfaceMutate1D.Modifiable<N extends Comparable<N>>- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long[] reference, byte addend) - Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
- Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long[] reference, double addend) - Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long[] reference, float addend) - Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long[] reference, int addend) - Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long[] reference, long addend) - Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
add
public void add(long[] reference, short addend) - Specified by:
addin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
aggregateRange
- Specified by:
aggregateRangein interfaceAccess1D.Aggregatable<N extends Comparable<N>>
-
aggregateSet
- Specified by:
aggregateSetin interfaceAccessAnyD.Aggregatable<N extends Comparable<N>>
-
aggregateSet
- Specified by:
aggregateSetin interfaceAccessAnyD.Aggregatable<N extends Comparable<N>>
-
build
- Specified by:
buildin interfaceFactoryAnyD.Builder<N extends Comparable<N>>
-
byteValue
public byte byteValue(int index) - Specified by:
byteValuein interfaceAccess1D<N extends Comparable<N>>
-
byteValue
public byte byteValue(long index) - Specified by:
byteValuein interfaceAccess1D<N extends Comparable<N>>
-
byteValue
public byte byteValue(long... ref) - Specified by:
byteValuein interfaceAccessAnyD<N extends Comparable<N>>
-
count
public long count()Description copied from interface:Structure1DThe 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:
countin interfaceStructure1D
-
count
public long count(int dimension) Description copied from interface:StructureAnyDcount() == count(0) * count(1) * count(2) * count(3) * ...- Specified by:
countin interfaceStructureAnyD
-
doubleValue
public double doubleValue(int index) - Specified by:
doubleValuein interfaceAccess1D<N extends Comparable<N>>
-
doubleValue
public double doubleValue(long index) - Specified by:
doubleValuein interfaceAccess1D<N extends Comparable<N>>
-
doubleValue
public double doubleValue(long... ref) - Specified by:
doubleValuein interfaceAccessAnyD<N extends Comparable<N>>
-
equals
-
expand
Description copied from interface:StructureAnyD.ReshapableIf necessary increase the rank to the specified number (without changing the total number of components)- Specified by:
expandin interfaceStructureAnyD.Reshapable
-
fillAll
- Specified by:
fillAllin interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillAll
- Specified by:
fillAllin interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillRange
- Specified by:
fillRangein interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillRange
- Specified by:
fillRangein interfaceMutate1D.Fillable<N extends Comparable<N>>
-
fillSet
- Specified by:
fillSetin interfaceMutateAnyD.Fillable<N extends Comparable<N>>
-
fillSet
- Specified by:
fillSetin interfaceMutateAnyD.Fillable<N extends Comparable<N>>
-
fillSet
- Specified by:
fillSetin interfaceMutateAnyD.Fillable<N extends Comparable<N>>
-
fillSet
- Specified by:
fillSetin interfaceMutateAnyD.Fillable<N extends Comparable<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:
flattenin interfaceStructureAnyD.Reshapable- See Also:
-
floatValue
public float floatValue(int index) - Specified by:
floatValuein interfaceAccess1D<N extends Comparable<N>>
-
floatValue
public float floatValue(long index) - Specified by:
floatValuein interfaceAccess1D<N extends Comparable<N>>
-
floatValue
public float floatValue(long... ref) - Specified by:
floatValuein interfaceAccessAnyD<N extends Comparable<N>>
-
get
-
get
- Specified by:
getin interfaceAccessAnyD<N extends Comparable<N>>
-
hashCode
-
indexOfLargest
public long indexOfLargest()- Specified by:
indexOfLargestin interfaceAccess1D.Aggregatable<N extends Comparable<N>>
-
intValue
public int intValue(int index) - Specified by:
intValuein interfaceAccess1D<N extends Comparable<N>>
-
intValue
public int intValue(long index) - Specified by:
intValuein interfaceAccess1D<N extends Comparable<N>>
-
intValue
public int intValue(long... ref) - Specified by:
intValuein interfaceAccessAnyD<N extends Comparable<N>>
-
longValue
public long longValue(int index) - Specified by:
longValuein interfaceAccess1D<N extends Comparable<N>>
-
longValue
public long longValue(long index) - Specified by:
longValuein interfaceAccess1D<N extends Comparable<N>>
-
longValue
public long longValue(long... ref) - Specified by:
longValuein interfaceAccessAnyD<N extends Comparable<N>>
-
mix
- Specified by:
mixin interfaceMutateAnyD.Mixable<N extends Comparable<N>>
-
mix
- Specified by:
mixin interfaceMutateAnyD.Mixable<N extends Comparable<N>>
-
modifyAll
- Specified by:
modifyAllin interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifyAny
- Specified by:
modifyAnyin interfaceMutateAnyD.ModifiableReceiver<N extends Comparable<N>>
-
modifyMatching
- Specified by:
modifyMatchingin interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifyMatching
- Specified by:
modifyMatchingin interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifyOne
- Specified by:
modifyOnein interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifyOne
- Specified by:
modifyOnein interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
modifyRange
- Specified by:
modifyRangein interfaceMutate1D.Modifiable<N extends Comparable<N>>
-
modifySet
- Specified by:
modifySetin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
modifySet
- Specified by:
modifySetin interfaceMutateAnyD.Modifiable<N extends Comparable<N>>
-
rank
public int rank()- Specified by:
rankin interfaceStructureAnyD- Returns:
- The number of dimensions (the number of indices used to reference one element)
-
reduce
- Specified by:
reducein interfaceStructureAnyD.ReducibleTo1D<N extends 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
- Specified by:
reducein interfaceStructureAnyD.ReducibleTo2D<N extends 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
-
reshape
Description copied from interface:StructureAnyD.ReshapableThe same array viewed/accessed with a different shape- Specified by:
reshapein interfaceStructureAnyD.Reshapable
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
-
set
public void set(long[] reference, byte value) - Specified by:
setin interfaceMutateAnyD
-
set
- Specified by:
setin interfaceMutateAnyD
-
set
public void set(long[] reference, double value) - Specified by:
setin interfaceMutateAnyD
-
set
public void set(long[] reference, float value) - Specified by:
setin interfaceMutateAnyD
-
set
public void set(long[] reference, int value) - Specified by:
setin interfaceMutateAnyD
-
set
public void set(long[] reference, long value) - Specified by:
setin interfaceMutateAnyD
-
set
public void set(long[] reference, short value) - Specified by:
setin interfaceMutateAnyD
-
shape
public long[] shape()- Specified by:
shapein interfaceStructureAnyD
-
shortValue
public short shortValue(int index) - Specified by:
shortValuein interfaceAccess1D<N extends Comparable<N>>
-
shortValue
public short shortValue(long index) - Specified by:
shortValuein interfaceAccess1D<N extends Comparable<N>>
-
shortValue
public short shortValue(long... ref) - Specified by:
shortValuein interfaceAccessAnyD<N extends Comparable<N>>
-
size
public int size()Description copied from interface:Structure1DThe total number of elements in this structure.- Specified by:
sizein interfaceStructure1D
-
size
public int size(int dimension) - Specified by:
sizein interfaceStructureAnyD
-
sliceRange
- Specified by:
sliceRangein interfaceAccess1D.Sliceable<N extends Comparable<N>>
-
sliceSet
Description copied from interface:AccessAnyD.SliceableIf 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:
sliceSetin interfaceAccessAnyD.Sliceable<N extends Comparable<N>>- Parameters:
initial- Indices pointing to what will be the first element of the slicedAccess1Ddimension- Which indices that make out an element reference should be incremented- Returns:
- A sliced 1D view of the underlying AnyD data structure
-
squeeze
Description copied from interface:StructureAnyD.ReshapableSqueezing removes the dimensions or axes that have a length of one. (This does not change the total number of components.)- Specified by:
squeezein interfaceStructureAnyD.Reshapable
-
supplyTo
- Specified by:
supplyToin interfaceAccessAnyD.Collectable<N extends Comparable<N>, MutateAnyD>
-
toString
-
visitAll
- Specified by:
visitAllin interfaceAccess1D.Visitable<N extends Comparable<N>>
-
visitOne
- Specified by:
visitOnein interfaceAccess1D.Visitable<N extends Comparable<N>>
-
visitOne
- Specified by:
visitOnein interfaceAccessAnyD.Visitable<N extends Comparable<N>>
-
visitRange
- Specified by:
visitRangein interfaceAccess1D.Visitable<N extends Comparable<N>>
-
visitSet
- Specified by:
visitSetin interfaceAccessAnyD.Visitable<N extends Comparable<N>>
-
visitSet
- Specified by:
visitSetin interfaceAccessAnyD.Visitable<N extends Comparable<N>>
-
factory
FactoryAnyD<ArrayAnyD<N>> factory() -
getDelegate
BasicArray<N> getDelegate()
-