public final class SparseArray<N extends Number> extends BasicArray<N>
Only stores nonzero elements and/or elements specifically set by the user. The nonzero elements are stored
internally in a DenseArray
.
Modifier and Type | Class and Description |
---|---|
static interface |
SparseArray.NonzeroPrimitiveCallback |
static interface |
SparseArray.NonzeroReferenceTypeCallback<N extends Number> |
static class |
SparseArray.NonzeroView<N extends Number> |
static class |
SparseArray.SparseFactory<N extends Number> |
BasicArray.Factory<N extends Number>
Access1D.Aggregatable<N extends Number>, Access1D.Collectable<N extends Number,R extends Mutate1D.Receiver<N>>, Access1D.Elements, Access1D.ElementView<N extends Number>, Access1D.IndexOf, Access1D.Sliceable<N extends Number>, Access1D.Visitable<N extends Number>
Mutate1D.Fillable<N extends Number>, Mutate1D.Mixable<N extends Number>, Mutate1D.Modifiable<N extends Number>, Mutate1D.ModifiableReceiver<N extends Number>, Mutate1D.Receiver<N extends Number>, Mutate1D.Sortable
Structure1D.BasicMapper<T>, Structure1D.IndexCallback, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,B extends Structure1D.Logical<S,?>>, Structure1D.LongIndex, Structure1D.LoopCallback
Modifier and Type | Method and Description |
---|---|
void |
add(long index,
double addend) |
void |
add(long index,
Number addend) |
void |
axpy(double a,
Mutate1D y)
Will calculate y = y + a x, will add "a" times "this" to "y"
|
long |
count() |
long |
countNonzeros() |
long |
countZeros() |
double |
dot(Access1D<?> vector)
Will calculate and return the dot product of this 1D-structure and another input 1D-vector.
|
double |
doubleValue(long index) |
protected void |
exchange(long firstA,
long firstB,
long step,
long count) |
static <N extends Number> |
factory(DenseArray.Factory<N> denseFactory) |
static <N extends Number> |
factory(DenseArray.Factory<N> denseFactory,
long count) |
protected void |
fill(long first,
long limit,
long step,
N value) |
protected void |
fill(long first,
long limit,
long step,
NullaryFunction<N> supplier) |
void |
fillAll(N value) |
void |
fillAll(NullaryFunction<N> supplier) |
void |
fillOne(long index,
Access1D<?> values,
long valueIndex) |
void |
fillOne(long index,
N value) |
void |
fillOne(long index,
NullaryFunction<N> supplier) |
void |
fillRange(long first,
long limit,
N value) |
void |
fillRange(long first,
long limit,
NullaryFunction<N> supplier) |
long |
firstInRange(long rangeFirst,
long rangeLimit) |
N |
get(long index) |
protected long |
indexOfLargest(long first,
long limit,
long step) |
boolean |
isAbsolute(long index) |
boolean |
isSmall(long index,
double comparedTo) |
protected boolean |
isSmall(long first,
long limit,
long step,
double comparedTo) |
long |
limitOfRange(long rangeFirst,
long rangeLimit) |
protected void |
modify(long first,
long limit,
long step,
Access1D<N> left,
BinaryFunction<N> function) |
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) |
void |
modifyAll(UnaryFunction<N> modifier) |
void |
modifyOne(long index,
UnaryFunction<N> modifier) |
SparseArray.NonzeroView<N> |
nonzeros() |
void |
reset()
Reset this mutable structure to some standard (all zeros) initial state.
|
void |
set(long index,
double value) |
void |
set(long index,
Number value) |
void |
supplyNonZerosTo(Mutate1D consumer) |
protected void |
visit(long first,
long limit,
long step,
VoidFunction<N> visitor) |
void |
visitOne(long index,
VoidFunction<N> visitor) |
void |
visitPrimitiveNonzerosInRange(long first,
long limit,
SparseArray.NonzeroPrimitiveCallback visitor) |
void |
visitRange(long first,
long limit,
VoidFunction<N> visitor) |
void |
visitReferenceTypeNonzerosInRange(long first,
long limit,
SparseArray.NonzeroReferenceTypeCallback<N> visitor) |
indexOfLargest, indexOfLargestInRange, makeDecreasingRange, makeDecreasingRange, makeIncreasingRange, makeIncreasingRange, modifyMatching, modifyMatching, modifyRange, toString, visitAll, wrapInArray1D, wrapInArray2D, wrapInArrayAnyD
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
asCollectable1D, asPrimitive1D, byteValue, elements, equals, floatValue, hashCode, intValue, longValue, shortValue, supplyTo, toRawCopy1D, toString, wrap, wrap, wrap
isAllSmall
copyComplexArgument, copyComplexImaginary, copyComplexModulus, copyComplexModulusAndArgument, copyComplexReal, copyComplexRealAndImaginary
fillMatching, fillMatching, fillMatching
index, loopAll, loopMatching, loopRange, mapper, size
public static <N extends Number> SparseArray.SparseFactory<N> factory(DenseArray.Factory<N> denseFactory)
public static <N extends Number> SparseArray.SparseFactory<N> factory(DenseArray.Factory<N> denseFactory, long count)
public void add(long index, double addend)
public void add(long index, Number addend)
public void axpy(double a, Mutate1D y)
Access1D
a
- The scaley
- The "vector" to updatepublic long count()
public long countNonzeros()
public long countZeros()
public double dot(Access1D<?> vector)
Access1D
vector
- Another 1D-structurepublic double doubleValue(long index)
public void fillAll(N value)
public void fillAll(NullaryFunction<N> supplier)
public void fillOne(long index, Access1D<?> values, long valueIndex)
public void fillOne(long index, N value)
public void fillOne(long index, NullaryFunction<N> supplier)
public void fillRange(long first, long limit, N value)
public void fillRange(long first, long limit, NullaryFunction<N> supplier)
public long firstInRange(long rangeFirst, long rangeLimit)
public N get(long index)
public boolean isAbsolute(long index)
Scalar.isAbsolute()
public boolean isSmall(long index, double comparedTo)
NormedVectorSpace.isSmall(double)
public long limitOfRange(long rangeFirst, long rangeLimit)
public void modifyAll(UnaryFunction<N> modifier)
modifyAll
in interface Mutate1D.Modifiable<N extends Number>
modifyAll
in class BasicArray<N extends Number>
public void modifyOne(long index, UnaryFunction<N> modifier)
public SparseArray.NonzeroView<N> nonzeros()
public void reset()
Mutate1D
public void set(long index, double value)
public void set(long index, Number value)
public void supplyNonZerosTo(Mutate1D consumer)
public void visitOne(long index, VoidFunction<N> visitor)
public void visitPrimitiveNonzerosInRange(long first, long limit, SparseArray.NonzeroPrimitiveCallback visitor)
public void visitRange(long first, long limit, VoidFunction<N> visitor)
visitRange
in interface Access1D.Visitable<N extends Number>
visitRange
in class BasicArray<N extends Number>
public void visitReferenceTypeNonzerosInRange(long first, long limit, SparseArray.NonzeroReferenceTypeCallback<N> visitor)
protected void exchange(long firstA, long firstB, long step, long count)
exchange
in class BasicArray<N extends Number>
protected void fill(long first, long limit, long step, N value)
fill
in class BasicArray<N extends Number>
protected void fill(long first, long limit, long step, NullaryFunction<N> supplier)
fill
in class BasicArray<N extends Number>
protected long indexOfLargest(long first, long limit, long step)
indexOfLargest
in class BasicArray<N extends Number>
protected boolean isSmall(long first, long limit, long step, double comparedTo)
isSmall
in class BasicArray<N extends Number>
protected void modify(long first, long limit, long step, Access1D<N> left, BinaryFunction<N> function)
modify
in class BasicArray<N extends Number>
protected void modify(long first, long limit, long step, BinaryFunction<N> function, Access1D<N> right)
modify
in class BasicArray<N extends Number>
protected void modify(long first, long limit, long step, UnaryFunction<N> function)
modify
in class BasicArray<N extends Number>
protected void visit(long first, long limit, long step, VoidFunction<N> visitor)
visit
in class BasicArray<N extends Number>
Copyright © 2019 Optimatika. All rights reserved.