org.ojalgo.array
Class PrimitiveArray

java.lang.Object
  extended by org.ojalgo.array.PrimitiveArray
All Implemented Interfaces:
Serializable, Access1D<Double>
Direct Known Subclasses:
PrimitiveDenseStore

public class PrimitiveArray
extends Object

A one- and/or arbitrary-dimensional array of double.

You cannot instantiate a PrimitiveArray directly. You have to either subclass it and implement instantiation code in that subclass, or use one of the static factory methods in Array1D, Array2D or ArrayAnyD.

Author:
apete
See Also:
Serialized Form

Field Summary
static boolean DEBUG
           
 int length
           
 
Method Summary
 Array1D<N> asArray1D()
           A utility facade that conveniently/consistently presents the BasicArray as a one-dimensional array.
 Array2D<N> asArray2D(int aRowDim, int aColDim)
           A utility facade that conveniently/consistently presents the BasicArray as a two-dimensional array.
 ArrayAnyD<N> asArrayAnyD(int[] aStructure)
           A utility facade that conveniently/consistently presents the BasicArray as a multi-dimensional array.
 double doubleValue(int anInd)
           
 boolean equals(Object anObj)
           
 void exchange(int aFirstA, int aFirstB, int aStep, int aCount)
           
 void fill(int aFirst, int aLimit, double aLeftArg, BinaryFunction<Double> aFunc, PrimitiveArray aRightArg)
           
 void fill(int aFirst, int aLimit, int aStep, Double aNmbr)
           
 void fill(int aFirst, int aLimit, PrimitiveArray aLeftArg, BinaryFunction<Double> aFunc, double aRightArg)
           
 void fill(int aFirst, int aLimit, PrimitiveArray aLeftArg, BinaryFunction<Double> aFunc, PrimitiveArray aRightArg)
           
 Double get(int anInd)
           
 int getIndexOfLargest(int aFirst, int aLimit, int aStep)
           
 int hashCode()
           
 boolean isAbsolute(int anInd)
           
 boolean isReal(int anInd)
           
 boolean isZero(int anInd)
           
 void modify(int aFirst, int aLimit, int aStep, BinaryFunction<Double> aFunc, Double aRightArg)
           
 void modify(int aFirst, int aLimit, int aStep, BinaryFunction<Double> aFunc, PrimitiveArray aRightArg)
           
 void modify(int aFirst, int aLimit, int aStep, Double aLeftArg, BinaryFunction<Double> aFunc)
           
 void modify(int aFirst, int aLimit, int aStep, ParameterFunction<Double> aFunc, int aParam)
           
 void modify(int aFirst, int aLimit, int aStep, PrimitiveArray aLeftArg, BinaryFunction<Double> aFunc)
           
 void modify(int aFirst, int aLimit, int aStep, UnaryFunction<Double> aFunc)
           
 int searchAscending(Double aNmbr)
           
 void set(int anInd, double aNmbr)
           
 void set(int anInd, Double aNmbr)
           
 int size()
           
 void sortAscending()
           
 Scalar<Double> toScalar(int anInd)
           
 String toString()
           
 void visit(int aFirst, int aLimit, int aStep, AggregatorFunction<Double> aVisitor)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG

length

public final int length
Method Detail

doubleValue

public final double doubleValue(int anInd)

equals

public boolean equals(Object anObj)
Overrides:
equals in class Object

exchange

public final void exchange(int aFirstA,
                           int aFirstB,
                           int aStep,
                           int aCount)

fill

public final void fill(int aFirst,
                       int aLimit,
                       double aLeftArg,
                       BinaryFunction<Double> aFunc,
                       PrimitiveArray aRightArg)

fill

public final void fill(int aFirst,
                       int aLimit,
                       int aStep,
                       Double aNmbr)

fill

public final void fill(int aFirst,
                       int aLimit,
                       PrimitiveArray aLeftArg,
                       BinaryFunction<Double> aFunc,
                       double aRightArg)

fill

public final void fill(int aFirst,
                       int aLimit,
                       PrimitiveArray aLeftArg,
                       BinaryFunction<Double> aFunc,
                       PrimitiveArray aRightArg)

get

public final Double get(int anInd)

getIndexOfLargest

public int getIndexOfLargest(int aFirst,
                             int aLimit,
                             int aStep)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isAbsolute

public final boolean isAbsolute(int anInd)
See Also:
Scalar.isAbsolute()

isReal

public final boolean isReal(int anInd)
See Also:
Scalar.isReal()

isZero

public final boolean isZero(int anInd)
See Also:
Scalar.isZero()

modify

public final void modify(int aFirst,
                         int aLimit,
                         int aStep,
                         BinaryFunction<Double> aFunc,
                         Double aRightArg)

modify

public final void modify(int aFirst,
                         int aLimit,
                         int aStep,
                         BinaryFunction<Double> aFunc,
                         PrimitiveArray aRightArg)

modify

public final void modify(int aFirst,
                         int aLimit,
                         int aStep,
                         Double aLeftArg,
                         BinaryFunction<Double> aFunc)

modify

public final void modify(int aFirst,
                         int aLimit,
                         int aStep,
                         ParameterFunction<Double> aFunc,
                         int aParam)

modify

public final void modify(int aFirst,
                         int aLimit,
                         int aStep,
                         PrimitiveArray aLeftArg,
                         BinaryFunction<Double> aFunc)

modify

public final void modify(int aFirst,
                         int aLimit,
                         int aStep,
                         UnaryFunction<Double> aFunc)

searchAscending

public final int searchAscending(Double aNmbr)
See Also:
Arrays.binarySearch(Object[], Object), sortAscending()

set

public final void set(int anInd,
                      double aNmbr)

set

public final void set(int anInd,
                      Double aNmbr)

sortAscending

public final void sortAscending()
See Also:
Arrays.sort(Object[]), searchAscending(Number)

toScalar

public final Scalar<Double> toScalar(int anInd)

visit

public final void visit(int aFirst,
                        int aLimit,
                        int aStep,
                        AggregatorFunction<Double> aVisitor)

asArray1D

public final Array1D<N> asArray1D()

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.

Disregards the array structure, and simply treats it as one-domensional.


asArray2D

public final Array2D<N> asArray2D(int aRowDim,
                                  int aColDim)

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.

If "this" has more than two dimensions then only the first plane of the first cube of the first... is used/accessed. If this only has one dimension then everything is assumed to be in the first column of the first plane of the first cube...


asArrayAnyD

public final ArrayAnyD<N> asArrayAnyD(int[] aStructure)

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.


size

public final int size()
Returns:
The total number of elements contained in this structure

toString

public String toString()
Overrides:
toString in class Object