IData
, java.io.Serializable
DataFunction
public class DataDoubleArray extends java.lang.Object implements IData, java.io.Serializable
All arithmetic methods throw ClassCastException if given a Data instance that is not a DataDoubleArray, and throw an IllegalArgumentException if the given DataDoubleArray is not of the same length as this one (array shape is not considered for arithmetic operations; only total length is relevant).
Modifier and Type | Class | Description |
---|---|---|
static class |
DataDoubleArray.DataInfoDoubleArray |
|
static class |
DataDoubleArray.DataInfoDoubleArrayFactory |
Constructor | Description |
---|---|
DataDoubleArray(int nValues) |
Constructs a new one-dimensional array of the given length.
|
DataDoubleArray(int[] arrayShape) |
Constructs a new multidimensional array of the given shape.
|
DataDoubleArray(int[] arrayShape,
double[] xData) |
Wraps the given array, xData in a DataDoubleArray of the given shape.
|
Modifier and Type | Method | Description |
---|---|---|
void |
assignColumnFrom(int i,
double[] array) |
Assigns values in given array to the i-th "hypercolumn" of this data array.
|
void |
assignColumnTo(int i,
double[] array) |
Assigns values in the i=th "hypercolumn" of this array to the given array.
|
void |
assignSubsectionFrom(int[] idx,
double[] array) |
Assigns values in the given array to the subsection of this array
beginning at the specified index.
|
void |
assignTo(double[] array) |
Returns the encapsulated array, implementing the Data interface.
|
void |
DE(double y) |
Divide-equals (*=) operation.
|
void |
DE(IData y) |
Divide-equals (/=) operation.
|
void |
E(double y) |
Equals (=) operation.
|
void |
E(double[] y) |
Copies each value in the given array to the values in the wrapped
array.
|
void |
E(IData y) |
Sets the wrapped array of values to the values in the given
instance.
|
int |
getArrayDimension() |
Returns the dimension of the array, which is the number of integer
indices needed to access one of its elements.
|
int |
getArrayShape(int i) |
Returns the length of the array in the i-th dimension.
|
double[] |
getData() |
Returns the encapsulated array.
|
int |
getLength() |
Returns the total length of the wrapped array.
|
double |
getValue(int i) |
Returns the i-th value of the wrapped array.
|
double |
getValue(int[] index) |
Returns the element of the array indicated by the given set of indices.
|
boolean |
isNaN() |
Returns true if any element of the encapsulated array is not-a-number, as
given by Double.isNaN.
|
void |
map(IFunction function) |
Replaces all values by the value of the function applied to each.
|
void |
ME(IData y) |
Minus-equals (-=) operation.
|
void |
PE(double y) |
Plus-equals (+=) operation.
|
void |
PE(IData y) |
Plus-equals (+=) operation.
|
void |
TE(double y) |
Times-equals (*=) operation.
|
void |
TE(IData y) |
Times-equals (*=) operation.
|
java.lang.String |
toString() |
Returns a string formed from the dataInfo label and the array values.
|
public DataDoubleArray(int nValues)
nValues
- length of the one-dimensional arraypublic DataDoubleArray(int[] arrayShape)
arrayShape
- length of the array in each dimensionpublic DataDoubleArray(int[] arrayShape, double[] xData)
arrayShape
- length of the array in each dimensionxData
- actual data to be held by this instance. The array is not
cloned.public int getArrayDimension()
public void E(IData y)
public void E(double[] y)
java.lang.IllegalArgumentException
- if the arrays are of different lengthspublic void PE(IData y)
public void ME(IData y)
public void TE(IData y)
public void DE(IData y)
public void E(double y)
public void PE(double y)
public void TE(double y)
public void DE(double y)
public void map(IFunction function)
public int getLength()
public int getArrayShape(int i)
public double getValue(int i)
public double getValue(int[] index)
java.lang.ArrayIndexOutOfBoundsException
- if length of given array is less than getArrayDimension (if
length is greater, excess indices are ignored).public double[] getData()
public boolean isNaN()
public void assignTo(double[] array)
public void assignColumnTo(int i, double[] array)
public void assignColumnFrom(int i, double[] array)
public void assignSubsectionFrom(int[] idx, double[] array)
idx
- index array of length less than or equal to getArrayDimension
(right-padded with zeros if shorter)array
- values to be copied into this arraypublic java.lang.String toString()
toString
in class java.lang.Object