public class F64FlatArray
extends F64Array
An 1-dimensional specialization of class F64Array.
class F64Array| Modifier and Type | Class and Description |
|---|---|
static class |
F64FlatArray.Companion |
F64Array.Viewer| Modifier and Type | Field and Description |
|---|---|
static F64FlatArray.Companion |
Companion |
| Modifier | Constructor and Description |
|---|---|
protected |
F64FlatArray(kotlin.Array[] data,
int offset,
int stride,
int size)
An 1-dimensional specialization of
class F64Array. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Void |
along(int axis)
Returns a sequence of views along the specified
axis. |
int |
argMax()
Returns the index of the maximum element.
|
int |
argMin()
Returns the index of the minimum element.
|
kotlin.sequences.Sequence<java.lang.Double> |
asSequence$module()
Returns a sequence of all array elements. Useful for testing.
|
protected F64FlatArray |
checkShape(F64Array other) |
F64FlatArray |
clone$module()
Returns a clone of this array. Useful for testing.
|
boolean |
contains(double other) |
F64FlatArray |
copy()
Returns a copy of this array.
|
void |
copyTo(F64Array other)
Copies elements in this array to
other array. |
void |
cumSum()
Computes cumulative sum of the elements.
|
F64FlatArray |
div(F64Array other) |
void |
divAssign(F64Array other) |
double |
dot(kotlin.Array[] other)
Computes a dot product between two vectors.
|
double |
dot(kotlin.Array[] other)
Computes a dot product between two vectors.
|
double |
dot(F64Array other)
Computes a dot product between two vectors.
|
boolean |
equals(java.lang.Object other) |
F64FlatArray |
exp()
A copying version of
expInPlace. |
F64FlatArray |
expm1()
A copying version of
expm1InPlace. |
void |
fill(double init)
Fills this array with a given
init value. |
F64FlatArray |
flatten()
Flattens the array into a 1D view in O(1) time.
|
double |
get(int pos) |
int |
hashCode() |
F64FlatArray |
log()
A copying version of
logInPlace. |
F64FlatArray |
log1p()
A copying version of
log1pInPlace. |
F64FlatArray |
logAddExp(F64Array other)
Computes elementwise
|
void |
logAddExpAssign(F64Array other)
Plus-assign for values stored as logarithms.
|
double |
logSumExp()
Computes
|
double |
max()
Returns the maximum element.
|
double |
min()
Returns the minimum element.
|
F64FlatArray |
minus(F64Array other) |
void |
minusAssign(F64Array other) |
F64FlatArray |
plus(F64Array other) |
void |
plusAssign(F64Array other) |
void |
reorder(kotlin.Array[] indices,
int axis)
Applies a given permutation of indices to the elements in the array.
|
F64Array |
reshape(int... shape)
Reshapes this array.
|
void |
set(int pos,
double value) |
double |
sum()
Returns the sum of the elements.
|
F64FlatArray |
times(F64Array other) |
void |
timesAssign(F64Array other) |
kotlin.Array[] |
toArray()
Converts this array to a conventional Kotlin structure.
|
kotlin.Array[] |
toDoubleArray()
Converts this vector to a DoubleArray.
|
java.lang.Void |
toGenericArray()
Converts this array to an Array.
|
java.lang.String |
toString(int maxDisplay,
java.text.DecimalFormat format)
Creates a String representation of the given array.
|
F64FlatArray |
transform(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Double> op)
A copying version of
transformInPlace. |
void |
transformInPlace(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Double> op)
Replaces each element x of this array with op(x) for the given unary operation
op. |
java.lang.Void |
view(int index,
int axis)
Returns a view of this array along the specified
axis. |
along, append, argMax, argMin, contains, copy, copyTo, cumSum, div, div, divAssign, divAssign, dot, dot, dot, dot, equals, exp, expInPlace, expm1, expm1InPlace, fill, flatten, get, get, get, get, getData, getNDim, getOffset, getShape, getSize, getStrides, getV, hashCode, isFlattenable, log, log1p, log1pInPlace, logAddExp, logAddExpAssign, logInPlace, logRescale, logSumExp, max, mean, min, minus, minus, minusAssign, minusAssign, plus, plus, plusAssign, plusAssign, reorder, rescale, reshape, sd, set, set, set, set, slice, sum, times, times, timesAssign, timesAssign, toArray, toDoubleArray, toGenericArray, toString, toString, transform, transformInPlace, unaryMinus, unaryPlus, viewpublic static F64FlatArray.Companion Companion
protected F64FlatArray(@NotNull
kotlin.Array[] data,
int offset,
int stride,
int size)
An 1-dimensional specialization of class F64Array.
class F64Arraypublic double get(int pos)
public void set(int pos,
double value)
@NotNull public F64FlatArray flatten()
Flattens the array into a 1D view in O(1) time.
Only implemented for flattenable arrays.
Viewer method.
public boolean contains(double other)
@NotNull public java.lang.Void along(int axis)
Returns a sequence of views along the specified axis.
For example, for a 2D array axis = 0 means "for each row",
and axis = 1 "for each column".
The array must have at least two dimensions.
Viewer method.
axis@NotNull
public java.lang.Void view(int index,
int axis)
@NotNull public F64FlatArray copy()
Returns a copy of this array.
The copy has the same shape as the original, but not necessary the same strides, since the copy is always flattenable and dense, even if the original array is not.
Copying method.
public void fill(double init)
Fills this array with a given init value.
In-place method.
initpublic void reorder(@NotNull
kotlin.Array[] indices,
int axis)
Applies a given permutation of indices to the elements in the array.
In-place method.
public double dot(@NotNull
kotlin.Array[] other)
Computes a dot product between two vectors.
Only implemented for flat arrays.
public double dot(@NotNull
kotlin.Array[] other)
Computes a dot product between two vectors.
Only implemented for flat arrays.
public double dot(@NotNull
F64Array other)
Computes a dot product between two vectors.
Only implemented for flat arrays. Optimized for dense arrays.
public double sum()
Returns the sum of the elements.
Optimized for dense arrays.
public void cumSum()
Computes cumulative sum of the elements.
In-place method. Only implemented for flat arrays.
public double min()
Returns the minimum element.
If any of array elements is NaN, the result is undefined but will be one of the array elements.
Optimized for dense arrays.
public int argMin()
Returns the index of the minimum element.
If any of array elements is NaN, the result is undefined but will be a valid index.
Only implemented for flat arrays.
public double max()
Returns the maximum element.
If any of array elements is NaN, the result is undefined but will be one of the array elements.
Optimized for dense arrays.
public int argMax()
Returns the index of the maximum element.
If any of array elements is NaN, the result is undefined but will be a valid index.
Only implemented for flat arrays.
public void transformInPlace(@NotNull
kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Double> op)
Replaces each element x of this array with op(x) for the given unary operation op.
If you need to apply one of the exp, expm1, log, log1p, use the appropriate specialized method instead
(see the list below); these will generally be much more efficient.
In-place method.
op - the unary operation to be applied.op,
expInPlace@NotNull public F64FlatArray transform(@NotNull kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Double> op)
A copying version of transformInPlace.
If you need to apply one of the exp, expm1, log, log1p, use the appropriate specialized method instead
(see the list below); these will generally be much more efficient.
Copying method.
op - the unary operation to be applied.transformInPlace,
exp@NotNull public F64FlatArray exp()
A copying version of expInPlace.
Copying method. Optimized for dense arrays.
expInPlace@NotNull public F64FlatArray expm1()
A copying version of expm1InPlace.
Copying method. Optimized for dense arrays.
expm1InPlace@NotNull public F64FlatArray log()
A copying version of logInPlace.
Copying method. Optimized for dense arrays.
logInPlace@NotNull public F64FlatArray log1p()
A copying version of log1pInPlace.
Copying method. Optimized for dense arrays.
log1pInPlacepublic double logSumExp()
Computes
log(Σ_x exp(x))
in a numerically stable way.
public void logAddExpAssign(@NotNull
F64Array other)
Plus-assign for values stored as logarithms.
In other words, the same as invoking
this[*i] = log(exp(this[*i]) + exp(other[*i]))
for every valid i.
In-place method.
@NotNull public F64FlatArray logAddExp(@NotNull F64Array other)
Computes elementwise
log(exp(this[*i]) + exp(other[*i]))
in a numerically stable way.
Copying method.
public void plusAssign(@NotNull
F64Array other)
@NotNull public F64FlatArray plus(@NotNull F64Array other)
public void minusAssign(@NotNull
F64Array other)
@NotNull public F64FlatArray minus(@NotNull F64Array other)
public void timesAssign(@NotNull
F64Array other)
@NotNull public F64FlatArray times(@NotNull F64Array other)
public void divAssign(@NotNull
F64Array other)
@NotNull public F64FlatArray div(@NotNull F64Array other)
@NotNull protected F64FlatArray checkShape(@NotNull F64Array other)
@NotNull public F64Array reshape(@NotNull int... shape)
Reshapes this array.
The original and the new array contain the same elements in the same order, if both are enumerated row-major.
For example, F64Array.of(1.0, 2.0, 3.0, 4.0, 5.0, 6.0).reshape(2, 3) produces a 2x3 matrix: [ 1.0,2.0,3.0, 4.0,5.0,6.0 ]
Only supported for flattenable arrays.
Viewer method.
@NotNull public kotlin.sequences.Sequence<java.lang.Double> asSequence$module()
Returns a sequence of all array elements. Useful for testing.
@NotNull public F64FlatArray clone$module()
Returns a clone of this array. Useful for testing.
@NotNull public kotlin.Array[] toArray()
Converts this array to a conventional Kotlin structure.
For example, a vector will be converted to a DoubleArray, a matrix will become Array etc.
Copying method.
@NotNull public java.lang.Void toGenericArray()
Converts this array to an Array.
For example, a matrix will become Array etc.
Copying method. Not implemented for flat arrays.
@NotNull public kotlin.Array[] toDoubleArray()
Converts this vector to a DoubleArray.
Copying method. Only implemented for flat arrays.
@NotNull
public java.lang.String toString(int maxDisplay,
@NotNull
java.text.DecimalFormat format)
Creates a String representation of the given array.
At most maxDisplay elements are printed for each dimension.
maxDisplaypublic boolean equals(@Nullable
java.lang.Object other)
public int hashCode()