Package org.ojalgo.array
Class BasicArray<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.array.BasicArray<N>
-
- All Implemented Interfaces:
Access1D<N>
,Access1D.Aggregatable<N>
,Access1D.Collectable<N,Mutate1D>
,Access1D.Visitable<N>
,Mutate1D
,Mutate1D.Fillable<N>
,Mutate1D.Modifiable<N>
,Structure1D
- Direct Known Subclasses:
DenseArray
,SegmentedArray
,SparseArray
public abstract class BasicArray<N extends java.lang.Comparable<N>> extends java.lang.Object implements Access1D<N>, Access1D.Aggregatable<N>, Access1D.Visitable<N>, Mutate1D, Mutate1D.Fillable<N>, Mutate1D.Modifiable<N>, Access1D.Collectable<N,Mutate1D>
A BasicArray is 1-dimensional, but designed to easily be extended or encapsulated, and then treated as arbitrary-dimensional. It stores/handles (any subclass of) Comparable elements depending on the subclass/implementation.
This abstract class defines a set of methods to access and modify array elements. It does not "know" anything about linear algebra or similar.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BasicArray.Factory<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Access1D
Access1D.Aggregatable<N extends java.lang.Comparable<N>>, Access1D.Collectable<N extends java.lang.Comparable<N>,R extends Mutate1D>, Access1D.ElementView<N extends java.lang.Comparable<N>>, Access1D.SelectionView<N extends java.lang.Comparable<N>>, Access1D.Sliceable<N extends java.lang.Comparable<N>>, Access1D.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.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,B extends Structure1D.Logical<S,B>>, Structure1D.LongIndex, Structure1D.LoopCallback
-
-
Field Summary
Fields Modifier and Type Field Description private ArrayFactory<N,?>
myFactory
-
Constructor Summary
Constructors Modifier Constructor Description private
BasicArray()
protected
BasicArray(ArrayFactory<N,?> factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description N
aggregateRange(long first, long limit, Aggregator aggregator)
boolean
equals(java.lang.Object obj)
protected void
exchange(long firstA, long firstB, long step, long count)
(package private) ArrayFactory<N,?>
factory()
protected void
fill(long first, long limit, long step, N value)
protected void
fill(long first, long limit, long step, NullaryFunction<?> supplier)
MathType
getMathType()
int
hashCode()
long
indexOfLargest()
protected long
indexOfLargest(long first, long limit, long step)
boolean
isPrimitive()
protected void
modify(long first, long limit, long step, BinaryFunction<N> function, Access1D<N> right)
protected void
modify(long first, long limit, long step, UnaryFunction<N> function)
protected void
modify(long first, long limit, long step, Access1D<N> left, BinaryFunction<N> function)
void
modifyAll(UnaryFunction<N> modifier)
void
modifyMatching(BinaryFunction<N> function, Access1D<N> right)
void
modifyMatching(Access1D<N> left, BinaryFunction<N> function)
void
modifyRange(long first, long limit, UnaryFunction<N> modifier)
void
supplyTo(Mutate1D receiver)
java.lang.String
toString()
protected void
visit(long first, long limit, long step, VoidFunction<N> visitor)
void
visitAll(VoidFunction<N> visitor)
void
visitRange(long first, long limit, VoidFunction<N> visitor)
protected Array1D<N>
wrapInArray1D()
A utility facade that conveniently/consistently presents the BasicArray as a one-dimensional array.protected Array2D<N>
wrapInArray2D(long structure)
A utility facade that conveniently/consistently presents the BasicArray as a two-dimensional array.protected ArrayAnyD<N>
wrapInArrayAnyD(long[] structure)
A utility facade that conveniently/consistently presents the BasicArray as a multi-dimensional array.-
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, byteValue, byteValue, dot, doubleValue, doubleValue, elements, floatValue, floatValue, get, intValue, intValue, longValue, longValue, nonzeros, select, shortValue, shortValue, supplyTo, toRawCopy1D
-
Methods inherited from interface org.ojalgo.structure.Access1D.Aggregatable
aggregateAll
-
Methods inherited from interface org.ojalgo.structure.Access1D.Collectable
collect
-
Methods inherited from interface org.ojalgo.structure.Access1D.Visitable
visitOne
-
Methods inherited from interface org.ojalgo.structure.Mutate1D
reset, set, set, set, set, set, set, set, set, set, set, set, set, set
-
Methods inherited from interface org.ojalgo.structure.Mutate1D.Fillable
fillAll, fillAll, fillCompatible, fillMatching, fillMatching, fillMatching, fillRange, fillRange
-
Methods inherited from interface org.ojalgo.structure.Mutate1D.Modifiable
add, add, add, add, add, add, add, modifyOne
-
Methods inherited from interface org.ojalgo.structure.Structure1D
count, size
-
-
-
-
Field Detail
-
myFactory
private final ArrayFactory<N extends java.lang.Comparable<N>,?> myFactory
-
-
Constructor Detail
-
BasicArray
private BasicArray()
-
BasicArray
protected BasicArray(ArrayFactory<N,?> factory)
-
-
Method Detail
-
aggregateRange
public N aggregateRange(long first, long limit, Aggregator aggregator)
- Specified by:
aggregateRange
in interfaceAccess1D.Aggregatable<N extends java.lang.Comparable<N>>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getMathType
public final MathType getMathType()
-
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>>
-
isPrimitive
public final boolean isPrimitive()
-
modifyAll
public void modifyAll(UnaryFunction<N> modifier)
- Specified by:
modifyAll
in interfaceMutate1D.Modifiable<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>>
-
modifyRange
public void modifyRange(long first, long limit, UnaryFunction<N> modifier)
- Specified by:
modifyRange
in interfaceMutate1D.Modifiable<N extends java.lang.Comparable<N>>
-
supplyTo
public void supplyTo(Mutate1D receiver)
- Specified by:
supplyTo
in interfaceAccess1D.Collectable<N extends java.lang.Comparable<N>,Mutate1D>
-
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>>
-
visitRange
public void visitRange(long first, long limit, VoidFunction<N> visitor)
- Specified by:
visitRange
in interfaceAccess1D.Visitable<N extends java.lang.Comparable<N>>
-
exchange
protected void exchange(long firstA, long firstB, long step, long count)
-
fill
protected void fill(long first, long limit, long step, N value)
-
fill
protected void fill(long first, long limit, long step, NullaryFunction<?> supplier)
-
indexOfLargest
protected long indexOfLargest(long first, long limit, long step)
-
modify
protected void modify(long first, long limit, long step, Access1D<N> left, BinaryFunction<N> function)
-
modify
protected void modify(long first, long limit, long step, BinaryFunction<N> function, Access1D<N> right)
-
modify
protected void modify(long first, long limit, long step, UnaryFunction<N> function)
-
visit
protected void visit(long first, long limit, long step, VoidFunction<N> visitor)
-
wrapInArray1D
protected final Array1D<N> wrapInArray1D()
A utility facade that conveniently/consistently presents the BasicArray as a one-dimensional array. Note that you will modify the actual array by accessing it through this facade.
-
wrapInArray2D
protected final Array2D<N> wrapInArray2D(long structure)
A utility facade that conveniently/consistently presents the BasicArray as a two-dimensional array. Note that you will modify the actual array by accessing it through this facade.
-
wrapInArrayAnyD
protected final ArrayAnyD<N> wrapInArrayAnyD(long[] structure)
A utility facade that conveniently/consistently presents the BasicArray as a multi-dimensional array. Note that you will modify the actual array by accessing it through this facade.
-
factory
final ArrayFactory<N,?> factory()
-
-