Interface ComplexNDArray<T extends Number>
-
- All Superinterfaces:
Iterable<org.apache.commons.math3.complex.Complex>
,NDArray<org.apache.commons.math3.complex.Complex>
- All Known Implementing Classes:
AbstractComplexNDArray
,BasicComplexDoubleNDArray
,BasicComplexFloatNDArray
,ComplexNDArrayMaskView
,ComplexNDArrayPermuteDimsView
,ComplexNDArrayReshapeView
,ComplexNDArraySliceView
public interface ComplexNDArray<T extends Number> extends NDArray<org.apache.commons.math3.complex.Complex>
General N-dimensional arrays holding complex values. The aim of this package to create an general framework to handle multidimensional data. The reference implementation is based on array of complex values form apache.math3, it is, however, super easy to write a wrapper to any array- or collection-implementation making it possible to combine the convenience of this interface with the advantages of the selected collection.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description NDArray<T>
abs()
Returns a new array holding the magnitude / absolute values of the elements.default ComplexNDArray<T>
accumulate(BinaryOperator<org.apache.commons.math3.complex.Complex> func, int... selectedDims)
Returns the accumulation of all elements along the specified dimensions in this NDArray.default ComplexNDArray<T>
add(byte addend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.default ComplexNDArray<T>
add(double addend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.default ComplexNDArray<T>
add(float addend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.default ComplexNDArray<T>
add(int addend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.default ComplexNDArray<T>
add(long addend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.default ComplexNDArray<T>
add(short addend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.default ComplexNDArray<T>
add(NDArray<?> addend)
Creates a new NDArray of the same shape and fills it with the element-wise sum of this NDArray and the NDArray given as parameter.default ComplexNDArray<T>
add(Object... addends)
Creates a new NDArray of the same shape and fills it with the element-wise sum of this NDArray and the parameter NDArrays and scalars.default ComplexNDArray<T>
addInplace(byte addend)
Updates this NDArray by incrementing all entries with the given value.default ComplexNDArray<T>
addInplace(double addend)
Updates this NDArray by incrementing all entries with the given value.default ComplexNDArray<T>
addInplace(float addend)
Updates this NDArray by incrementing all entries with the given value.default ComplexNDArray<T>
addInplace(int addend)
Updates this NDArray by incrementing all entries with the given value.default ComplexNDArray<T>
addInplace(long addend)
Updates this NDArray by incrementing all entries with the given value.default ComplexNDArray<T>
addInplace(short addend)
Updates this NDArray by incrementing all entries with the given value.default ComplexNDArray<T>
addInplace(NDArray<?> addend)
Updates this NDArray with the element-wise sum of this NDArray and the one given as parameter.default ComplexNDArray<T>
addInplace(Object... addends)
Updates this NDArray with the element-wise sum of this NDArray and the ones given as parameters.ComplexNDArray<T>
apply(UnaryOperator<org.apache.commons.math3.complex.Complex> func)
Apply the given function to each element of the array, and override each entry with the calculated new values.ComplexNDArray<T>
applyOnComplexSlices(BiFunction<ComplexNDArray<T>,int[],NDArray<?>> func, int... iterationDims)
Apply the given function to each slices of the array, and override each entry with the returned slice.ComplexNDArray<T>
applyWithCartesianIndices(BiFunction<org.apache.commons.math3.complex.Complex,int[],org.apache.commons.math3.complex.Complex> func)
Apply the given function to each element of the array, and override each entry with the calculated new values.ComplexNDArray<T>
applyWithLinearIndices(BiFunction<org.apache.commons.math3.complex.Complex,Integer,org.apache.commons.math3.complex.Complex> func)
Apply the given function to each element of the array, and override each entry with the calculated new values.NDArray<T>
argument()
Returns a new array holding the argument / argument of the elements.default ComplexNDArray<T>
concatenate(int axis, NDArray<?>... arrays)
Creates a new NDArray that contains the elements of this NDArrays and all other NDArrays concatenated along the dimension/axis specified by the first parameter.String
contentToString(String format)
Returns a String containing tabular representation of the array.ComplexNDArray<T>
copy()
Returns a copy of this NDArray.default ComplexNDArray<T>
copyFrom(byte[] array)
Updates this NDArray with the elements of the array given as parameter.default ComplexNDArray<T>
copyFrom(byte[] real, byte[] imag)
Updates this NDArray with the elements of the arrays given as parameters.default ComplexNDArray<T>
copyFrom(double[] array)
Updates this NDArray with the elements of the array given as parameter.default ComplexNDArray<T>
copyFrom(double[] real, double[] imag)
Updates this NDArray with the elements of the arrays given as parameters.default ComplexNDArray<T>
copyFrom(float[] array)
Updates this NDArray with the elements of the array given as parameter.default ComplexNDArray<T>
copyFrom(float[] real, float[] imag)
Updates this NDArray with the elements of the arrays given as parameters.default ComplexNDArray<T>
copyFrom(int[] array)
Updates this NDArray with the elements of the array given as parameter.default ComplexNDArray<T>
copyFrom(int[] real, int[] imag)
Updates this NDArray with the elements of the arrays given as parameters.default ComplexNDArray<T>
copyFrom(long[] array)
Updates this NDArray with the elements of the array given as parameter.default ComplexNDArray<T>
copyFrom(long[] real, long[] imag)
Updates this NDArray with the elements of the arrays given as parameters.default ComplexNDArray<T>
copyFrom(short[] array)
Updates this NDArray with the elements of the array given as parameter.default ComplexNDArray<T>
copyFrom(short[] real, short[] imag)
Updates this NDArray with the elements of the arrays given as parameters.default ComplexNDArray<T>
copyFrom(NDArray<?> array)
Updates this NDArray with the elements of the NDArray given as parameter.default ComplexNDArray<T>
copyFrom(NDArray<? extends Number> real, NDArray<? extends Number> imag)
Updates this NDArray with the elements of the arrays given as parameters.default ComplexNDArray<T>
copyFrom(Object[] array)
Updates this NDArray with the elements of the array given as parameter.default ComplexNDArray<T>
copyFrom(Object[] real, Object[] imag)
Updates this NDArray with the elements of the arrays given as parameters.default ComplexNDArray<T>
divide(byte divisor)
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divide(double divisor)
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divide(float divisor)
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divide(int divisor)
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divide(long divisor)
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divide(short divisor)
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divide(NDArray<?> divisor)
Creates a new NDArray of the same shape and fills it with the element-wise division of this NDArray and the NDArray given as parameter.default ComplexNDArray<T>
divide(Object... divisors)
Creates a new NDArray of the same shape and fills it with the result of the element-wise division of this NDArray by the parameter NDArrays and scalars.default ComplexNDArray<T>
divideInplace(byte divisor)
Updates the elements this NDArray with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divideInplace(double divisor)
Updates the elements this NDArray with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divideInplace(float divisor)
Updates the elements this NDArray with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divideInplace(int divisor)
Updates the elements this NDArray with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divideInplace(long divisor)
Updates the elements this NDArray with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divideInplace(short divisor)
Updates the elements this NDArray with the values of this NDArray divided by the given value.default ComplexNDArray<T>
divideInplace(NDArray<?> divisor)
Updates the elements this NDArray with the element-wise division of this NDArray and the NDArray given as parameter.default ComplexNDArray<T>
divideInplace(Object... divisors)
Updates the elements this NDArray with the result of the element-wise division of this NDArray by the parameter NDArrays and scalars.default ComplexNDArray<T>
dropDims(int... selectedDims)
Returns a view that references this NDArray as parent, and skips all singleton dimensions included in the parameter list.Class<?>
dtype2()
Returns the type of values returned by getReal and getImag methods.default ComplexNDArray<T>
fill(double value)
Fill this NDArray with the specified valuedefault ComplexNDArray<T>
fill(org.apache.commons.math3.complex.Complex value)
Fill this NDArray with the specified valuedefault ComplexNDArray<T>
fill(T value)
Fill this NDArray with the specified valueComplexNDArray<T>
fillUsingCartesianIndices(Function<int[],org.apache.commons.math3.complex.Complex> func)
Apply the given function to each element of the array, and override each entry with the calculated new values.ComplexNDArray<T>
fillUsingLinearIndices(IntFunction<org.apache.commons.math3.complex.Complex> func)
Apply the given function to each element of the array, and override each entry with the calculated new values.T
getImag(int linearIndex)
Returns the imaginary part of an element specified by linear indexing.T
getImag(int... indices)
Returns the imaginary part of an element specified by cartesian indexing.T
getReal(int linearIndex)
Returns the real part of an element specified by linear indexing.T
getReal(int... indices)
Returns the real part of an element specified by cartesian indexing.NDArray<T>
imaginary()
Returns a new array holding the imaginary part of the arraydefault ComplexNDArray<T>
inverseMask(NDArray<?> mask)
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements of the array selected by the given inverseMask.default ComplexNDArray<T>
map(UnaryOperator<org.apache.commons.math3.complex.Complex> func)
Apply the given function to each element of the array, and create a new NDArray with the calculated new values.ComplexNDArray<T>
mapOnComplexSlices(BiFunction<ComplexNDArray<T>,int[],NDArray<?>> func, int... iterationDims)
Apply the given function to each slices of the array, and create a new NDArray with the calculated new values.default ComplexNDArray<T>
mapWithCartesianIndices(BiFunction<org.apache.commons.math3.complex.Complex,int[],org.apache.commons.math3.complex.Complex> func)
Apply the given function to each element of the array, and create a new NDArray with the calculated new values.default ComplexNDArray<T>
mapWithLinearIndices(BiFunction<org.apache.commons.math3.complex.Complex,Integer,org.apache.commons.math3.complex.Complex> func)
Apply the given function to each element of the array, and create a new NDArray with the calculated new values.default ComplexNDArray<T>
mask(NDArray<?> mask)
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements of the array selected by the given mask.default ComplexNDArray<T>
mask(Predicate<org.apache.commons.math3.complex.Complex> func)
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements for which the given function returns true.default ComplexNDArray<T>
maskWithCartesianIndices(BiPredicate<org.apache.commons.math3.complex.Complex,int[]> func)
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements for which the given function returns true.default ComplexNDArray<T>
maskWithLinearIndices(BiPredicate<org.apache.commons.math3.complex.Complex,Integer> func)
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements for which the given function returns true.default ComplexNDArray<T>
multiply(byte multiplicand)
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiply(double multiplicand)
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiply(float multiplicand)
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiply(int multiplicand)
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiply(long multiplicand)
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiply(short multiplicand)
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiply(NDArray<?> multiplicand)
Creates a new NDArray of the same shape and fills it with the element-wise product of this NDArray and the NDArray given as parameter.default ComplexNDArray<T>
multiply(Object... multiplicands)
Creates a new NDArray of the same shape and fills it with the element-wise product of this NDArray and the parameter NDArrays and scalars.default ComplexNDArray<T>
multiplyInplace(byte multiplicand)
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiplyInplace(double multiplicand)
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiplyInplace(float multiplicand)
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiplyInplace(int multiplicand)
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiplyInplace(long multiplicand)
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiplyInplace(short multiplicand)
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.default ComplexNDArray<T>
multiplyInplace(NDArray<?> multiplicand)
Updates the elements of this NDArray with the element-wise product of this NDArray and the NDArray given as parameter.default ComplexNDArray<T>
multiplyInplace(Object... multiplicands)
Updates the elements of this NDArray with the element-wise product of this NDArray and the parameter NDArrays and scalars.default ComplexNDArray<T>
permuteDims(int... permutation)
Returns a view that references this NDArray as parent, but the order of dimensions are swiched in this view.default ComplexNDArray<T>
prod(int... selectedDims)
Returns the product of all elements along the specified dimensions in this NDArray.NDArray<T>
real()
Returns a new array holding the real part of the arraydefault ComplexNDArray<T>
reduceComplexSlices(BiFunction<ComplexNDArray<T>,int[],org.apache.commons.math3.complex.Complex> func, int... selectedDims)
Reduces slices along the specified dimensions in this NDArray to scalar values, reducing the number of dimensions.default ComplexNDArray<T>
reshape(int... newShape)
Returns a view that references this NDArray as parent but has a different shape.default ComplexNDArray<T>
selectDims(int... selectedDims)
Returns a view that references this NDArray as parent, and skips all singleton dimensions not included in the parameter list.void
setImag(Number value, int linearIndex)
Sets the imaginary part of an element specified by linear indexing.void
setImag(Number value, int... indices)
Sets the imaginary part of an element specified by cartesian indexing.void
setReal(Number value, int linearIndex)
Sets the real part of an element specified by linear indexing.void
setReal(Number value, int... indices)
Sets the real part of an element specified by cartesian indexing.ComplexNDArray<T>
similar()
Returns a new array of the same shape as this NDArray filled with zeros.default ComplexNDArray<T>
slice(Object... slicingExpressions)
Returns an array view referencing this NDArray as parent that gives read-write access to a specific multi-dimensional slice of the array.default ComplexNDArray<T>
squeeze()
Returns a view that references this NDArray as parent, and skips all singleton dimensions.default ComplexNDArray<T>
subtract(byte substrahend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.default ComplexNDArray<T>
subtract(double substrahend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.default ComplexNDArray<T>
subtract(float substrahend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.default ComplexNDArray<T>
subtract(int substrahend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.default ComplexNDArray<T>
subtract(long substrahend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.default ComplexNDArray<T>
subtract(short substrahend)
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.default ComplexNDArray<T>
subtract(NDArray<?> substrahend)
Creates a new NDArray of the same shape and fills it with the element-wise subtraction of the given NDArray from this NDArray.default ComplexNDArray<T>
subtract(Object... substrahends)
Creates a new NDArray of the same shape and fills it with the result of the element-wise substraction the parameter NDArrays and scalars from this NDArray.default ComplexNDArray<T>
subtractInplace(byte substrahend)
Updates this NDArray by subtracting the given value from all entries of this NDArray.default ComplexNDArray<T>
subtractInplace(double substrahend)
Updates this NDArray by subtracting the given value from all entries of this NDArray.default ComplexNDArray<T>
subtractInplace(float substrahend)
Updates this NDArray by subtracting the given value from all entries of this NDArray.default ComplexNDArray<T>
subtractInplace(int substrahend)
Updates this NDArray by subtracting the given value from all entries of this NDArray.default ComplexNDArray<T>
subtractInplace(long substrahend)
Updates this NDArray by subtracting the given value from all entries of this NDArray.default ComplexNDArray<T>
subtractInplace(short substrahend)
Updates this NDArray by subtracting the given value from all entries of this NDArray.default ComplexNDArray<T>
subtractInplace(NDArray<?> substrahend)
Updates this NDArray with the element-wise subtraction of the given NDArray from this NDArray.default ComplexNDArray<T>
subtractInplace(Object... substrahends)
Updates the elements this NDArray with the result of the element-wise subtraction the parameter NDArrays and scalars from this NDArray.default ComplexNDArray<T>
sum(int... selectedDims)
Returns the sum of all elements along the specified dimensions in this NDArray.-
Methods inherited from interface io.github.hakkelt.ndarrays.NDArray
accumulate, applyOnSlices, contains, contentToString, dataTypeAsString, dtype, equals, forEach, forEachWithCartesianIndices, forEachWithLinearIndices, get, get, getNamePrefix, hashCode, iterator, length, mapOnSlices, ndim, norm, norm, norm, parallelStream, prod, reduceSlices, set, set, set, set, shape, shape, spliterator, stream, streamCartesianIndices, streamLinearIndices, sum, toArray, toArray, toArray, toString, writeToFile
-
-
-
-
Method Detail
-
dtype2
Class<?> dtype2()
Returns the type of values returned by getReal and getImag methods. Possible values:Float.class
,Double.class
.- Returns:
- the type of values returned by get method.
-
contentToString
String contentToString(String format)
Returns a String containing tabular representation of the array. For arrays that have more than 2 dimensions, the function prints 2D slices and iterates over all other dimensions incrementally. Note: this function might produce enormous output as it doesn't truncate result even for large arrays!- Specified by:
contentToString
in interfaceNDArray<T extends Number>
- Parameters:
format
- format specifier for real/imaginary part of individual elements (e.g. 5.3f)- Returns:
- a String containing tabular representation of the array.
-
getReal
T getReal(int linearIndex)
Returns the real part of an element specified by linear indexing.Linear indexing: It selects the ith element using the column-major iteration order that linearly spans the entire array.
Negative indexing is supported: e.g. -1 refers to the last element, -2 refers to the item before the last one, etc.
- Parameters:
linearIndex
- linear index- Returns:
- the real part of an element specified by linear indexing
-
getImag
T getImag(int linearIndex)
Returns the imaginary part of an element specified by linear indexing.Linear indexing: It selects the ith element using the column-major iteration order that linearly spans the entire array.
Negative indexing is supported: e.g. -1 refers to the last element, -2 refers to the item before the last one, etc.
- Parameters:
linearIndex
- linear index- Returns:
- the imaginary part of an element specified by linear indexing
-
getReal
T getReal(int... indices)
Returns the real part of an element specified by cartesian indexing.Cartesian indexing: The ordinary way to index into an N-dimensional array is to use exactly N indices; each index selects the position(s) in its particular dimension.
Negative indexing is supported: e.g. assuming a 3×4 NDArray, index [2,-1] equals to [2,3], and [-1,-3] is an equivalent of [2,1].
- Parameters:
indices
- cartesian coordinates- Returns:
- the real part of an element specified by cartesian indexing
-
getImag
T getImag(int... indices)
Returns the imaginary part of an element specified by cartesian indexing.Cartesian indexing: The ordinary way to index into an N-dimensional array is to use exactly N indices; each index selects the position(s) in its particular dimension.
Negative indexing is supported: e.g. assuming a 3×4 NDArray, index [2,-1] equals to [2,3], and [-1,-3] is an equivalent of [2,1].
- Parameters:
indices
- cartesian coordinates- Returns:
- the imaginary part of an element specified by cartesian indexing
-
setReal
void setReal(Number value, int linearIndex)
Sets the real part of an element specified by linear indexing.Linear indexing: It selects the ith element using the column-major iteration order that linearly spans the entire array.
Negative indexing is supported: e.g. -1 refers to the last element, -2 refers to the item before the last one, etc.
Note: If used on complex arrays, the imaginary part of the assigned element will be untouched.
- Parameters:
value
- real value to be assigned as real part of some elementlinearIndex
- linear index
-
setImag
void setImag(Number value, int linearIndex)
Sets the imaginary part of an element specified by linear indexing.Linear indexing: It selects the ith element using the column-major iteration order that linearly spans the entire array.
Negative indexing is supported: e.g. -1 refers to the last element, -2 refers to the item before the last one, etc.
Note: If used on complex arrays, the imaginary part of the assigned element will be untouched.
- Parameters:
value
- imaginary value to be assigned as imaginary part of some elementlinearIndex
- linear index
-
setReal
void setReal(Number value, int... indices)
Sets the real part of an element specified by cartesian indexing.Cartesian indexing: The ordinary way to index into an N-dimensional array is to use exactly N indices; each index selects the position(s) in its particular dimension.
Negative indexing is supported: e.g. assuming a 3×4 NDArray, index [2,-1] equals to [2,3], and [-1,-3] is an equivalent of [2,1].
Note: If used on complex arrays, the imaginary part of the assigned element will be untouched.
- Parameters:
value
- real value to be assigned as real part of some elementindices
- cartesian coordinates
-
setImag
void setImag(Number value, int... indices)
Sets the imaginary part of an element specified by cartesian indexing.Cartesian indexing: The ordinary way to index into an N-dimensional array is to use exactly N indices; each index selects the position(s) in its particular dimension.
Negative indexing is supported: e.g. assuming a 3×4 NDArray, index [2,-1] equals to [2,3], and [-1,-3] is an equivalent of [2,1].
Note: If used on complex arrays, the imaginary part of the assigned element will be untouched.
- Parameters:
value
- imaginary value to be assigned as imaginary part of some elementindices
- cartesian coordinates
-
copyFrom
default ComplexNDArray<T> copyFrom(float[] array)
Description copied from interface:NDArray
Updates this NDArray with the elements of the array given as parameter.Note: the parameter array must have the same shape and this NDArray!
-
copyFrom
default ComplexNDArray<T> copyFrom(double[] array)
Description copied from interface:NDArray
Updates this NDArray with the elements of the array given as parameter.Note: the parameter array must have the same shape and this NDArray!
-
copyFrom
default ComplexNDArray<T> copyFrom(byte[] array)
Description copied from interface:NDArray
Updates this NDArray with the elements of the array given as parameter.Note: the parameter array must have the same shape and this NDArray!
-
copyFrom
default ComplexNDArray<T> copyFrom(short[] array)
Description copied from interface:NDArray
Updates this NDArray with the elements of the array given as parameter.Note: the parameter array must have the same shape and this NDArray!
-
copyFrom
default ComplexNDArray<T> copyFrom(int[] array)
Description copied from interface:NDArray
Updates this NDArray with the elements of the array given as parameter.Note: the parameter array must have the same shape and this NDArray!
-
copyFrom
default ComplexNDArray<T> copyFrom(long[] array)
Description copied from interface:NDArray
Updates this NDArray with the elements of the array given as parameter.Note: the parameter array must have the same shape and this NDArray!
-
copyFrom
default ComplexNDArray<T> copyFrom(Object[] array)
Description copied from interface:NDArray
Updates this NDArray with the elements of the array given as parameter.Note: the parameter array must have the same shape and this NDArray!
-
copyFrom
default ComplexNDArray<T> copyFrom(NDArray<?> array)
Description copied from interface:NDArray
Updates this NDArray with the elements of the NDArray given as parameter.Note: the parameter NDArray must have the same shape and this NDArray!
-
copyFrom
default ComplexNDArray<T> copyFrom(float[] real, float[] imag)
Updates this NDArray with the elements of the arrays given as parameters.Note: both parameter arrays must have the same shape and this NDArray!
Note: if this function is called on real arrays, it will throw UnsupportedOperationException!
- Parameters:
real
- array holding the new values to be copied to this NDArray as real partimag
- array holding the new values to be copied to this NDArray as imaginary part- Returns:
- this NDArray
-
copyFrom
default ComplexNDArray<T> copyFrom(double[] real, double[] imag)
Updates this NDArray with the elements of the arrays given as parameters.Note: both parameter arrays must have the same shape and this NDArray!
Note: if this function is called on real arrays, it will throw UnsupportedOperationException!
- Parameters:
real
- array holding the new values to be copied to this NDArray as real partimag
- array holding the new values to be copied to this NDArray as imaginary part- Returns:
- this NDArray
-
copyFrom
default ComplexNDArray<T> copyFrom(byte[] real, byte[] imag)
Updates this NDArray with the elements of the arrays given as parameters.Note: both parameter arrays must have the same shape and this NDArray!
Note: if this function is called on real arrays, it will throw UnsupportedOperationException!
- Parameters:
real
- array holding the new values to be copied to this NDArray as real partimag
- array holding the new values to be copied to this NDArray as imaginary part- Returns:
- this NDArray
-
copyFrom
default ComplexNDArray<T> copyFrom(short[] real, short[] imag)
Updates this NDArray with the elements of the arrays given as parameters.Note: both parameter arrays must have the same shape and this NDArray!
Note: if this function is called on real arrays, it will throw UnsupportedOperationException!
- Parameters:
real
- array holding the new values to be copied to this NDArray as real partimag
- array holding the new values to be copied to this NDArray as imaginary part- Returns:
- this NDArray
-
copyFrom
default ComplexNDArray<T> copyFrom(int[] real, int[] imag)
Updates this NDArray with the elements of the arrays given as parameters.Note: both parameter arrays must have the same shape and this NDArray!
Note: if this function is called on real arrays, it will throw UnsupportedOperationException!
- Parameters:
real
- array holding the new values to be copied to this NDArray as real partimag
- array holding the new values to be copied to this NDArray as imaginary part- Returns:
- this NDArray
-
copyFrom
default ComplexNDArray<T> copyFrom(long[] real, long[] imag)
Updates this NDArray with the elements of the arrays given as parameters.Note: both parameter arrays must have the same shape and this NDArray!
Note: if this function is called on real arrays, it will throw UnsupportedOperationException!
- Parameters:
real
- array holding the new values to be copied to this NDArray as real partimag
- array holding the new values to be copied to this NDArray as imaginary part- Returns:
- this NDArray
-
copyFrom
default ComplexNDArray<T> copyFrom(Object[] real, Object[] imag)
Updates this NDArray with the elements of the arrays given as parameters.Note: both parameter arrays must have the same shape and this NDArray!
- Parameters:
real
- array holding the new values to be copied to this NDArray as real partimag
- array holding the new values to be copied to this NDArray as imaginary part- Returns:
- this NDArray
-
copyFrom
default ComplexNDArray<T> copyFrom(NDArray<? extends Number> real, NDArray<? extends Number> imag)
Updates this NDArray with the elements of the arrays given as parameters.Note: both parameter arrays must have the same shape and this NDArray!
- Parameters:
real
- array holding the new values to be copied to this NDArray as real partimag
- array holding the new values to be copied to this NDArray as imaginary part- Returns:
- this NDArray
-
fillUsingLinearIndices
ComplexNDArray<T> fillUsingLinearIndices(IntFunction<org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Apply the given function to each element of the array, and override each entry with the calculated new values. Please note that entries might not be processed in a sequential order!- Specified by:
fillUsingLinearIndices
in interfaceNDArray<T extends Number>
- Parameters:
func
- function that receives the linear index of the current entry, and returns the new value- Returns:
- itself after the update
-
fillUsingCartesianIndices
ComplexNDArray<T> fillUsingCartesianIndices(Function<int[],org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Apply the given function to each element of the array, and override each entry with the calculated new values. Please note that entries might not be processed in a sequential order!- Specified by:
fillUsingCartesianIndices
in interfaceNDArray<T extends Number>
- Parameters:
func
- function that receives the Cartesian coordinate of the current entry, and returns the new value- Returns:
- itself after the update
-
apply
ComplexNDArray<T> apply(UnaryOperator<org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Apply the given function to each element of the array, and override each entry with the calculated new values. Please note that entries might not be processed in a sequential order!
-
applyWithLinearIndices
ComplexNDArray<T> applyWithLinearIndices(BiFunction<org.apache.commons.math3.complex.Complex,Integer,org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Apply the given function to each element of the array, and override each entry with the calculated new values. Please note that entries might not be processed in a sequential order!- Specified by:
applyWithLinearIndices
in interfaceNDArray<T extends Number>
- Parameters:
func
- function that receives the value of the current entry and its linear index, and returns the new value- Returns:
- itself after the update
-
applyWithCartesianIndices
ComplexNDArray<T> applyWithCartesianIndices(BiFunction<org.apache.commons.math3.complex.Complex,int[],org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Apply the given function to each element of the array, and override each entry with the calculated new values. Please note that entries might not be processed in a sequential order!- Specified by:
applyWithCartesianIndices
in interfaceNDArray<T extends Number>
- Parameters:
func
- function that receives the value of the current entry and its Cartesian coordinate, and returns the new value- Returns:
- itself after the update
-
applyOnComplexSlices
ComplexNDArray<T> applyOnComplexSlices(BiFunction<ComplexNDArray<T>,int[],NDArray<?>> func, int... iterationDims)
Apply the given function to each slices of the array, and override each entry with the returned slice. Please note that slices might not be processed in a sequential order!- Parameters:
func
- function that receives the value of the current entry and its Cartesian coordinate, and returns a slice from which values are copied to original arrayiterationDims
- dimensions along which iteration is performed- Returns:
- itself after the update
-
map
default ComplexNDArray<T> map(UnaryOperator<org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Apply the given function to each element of the array, and create a new NDArray with the calculated new values. Please note that entries might not be processed in a sequential order!
-
mapWithLinearIndices
default ComplexNDArray<T> mapWithLinearIndices(BiFunction<org.apache.commons.math3.complex.Complex,Integer,org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Apply the given function to each element of the array, and create a new NDArray with the calculated new values. Please note that entries might not be processed in a sequential order!- Specified by:
mapWithLinearIndices
in interfaceNDArray<T extends Number>
- Parameters:
func
- function that receives the value of the current entry and its linear index, and returns the new value- Returns:
- the new NDArray with the calculated new values
-
mapWithCartesianIndices
default ComplexNDArray<T> mapWithCartesianIndices(BiFunction<org.apache.commons.math3.complex.Complex,int[],org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Apply the given function to each element of the array, and create a new NDArray with the calculated new values. Please note that entries might not be processed in a sequential order!- Specified by:
mapWithCartesianIndices
in interfaceNDArray<T extends Number>
- Parameters:
func
- function that receives the value of the current entry and its Cartesian coordinate, and returns the new value- Returns:
- the new NDArray with the calculated new values
-
mapOnComplexSlices
ComplexNDArray<T> mapOnComplexSlices(BiFunction<ComplexNDArray<T>,int[],NDArray<?>> func, int... iterationDims)
Apply the given function to each slices of the array, and create a new NDArray with the calculated new values. Please note that slices might not be processed in a sequential order!- Parameters:
func
- function that receives slice and its Cartesian coordinate along the iteration dimensions, and returns a new array with the same size as the sliceiterationDims
- dimensions along which iteration is performed- Returns:
- the new NDArray with the calculated new values
-
real
NDArray<T> real()
Returns a new array holding the real part of the array- Returns:
- the real part of the array
-
imaginary
NDArray<T> imaginary()
Returns a new array holding the imaginary part of the array- Returns:
- the imaginary part of the array
-
abs
NDArray<T> abs()
Returns a new array holding the magnitude / absolute values of the elements.- Returns:
- a new array holding the magnitude / absolute values of the elements.
-
argument
NDArray<T> argument()
Returns a new array holding the argument / argument of the elements.- Returns:
- a new array holding the argument / argument of the elements.
-
add
default ComplexNDArray<T> add(Object... addends)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the element-wise sum of this NDArray and the parameter NDArrays and scalars. If list of parameters contains scalar values than these will be added to all elements of the resulting array.Note: The type of this NDArray determines type of the resulting NDArray.
-
addInplace
default ComplexNDArray<T> addInplace(Object... addends)
Description copied from interface:NDArray
Updates this NDArray with the element-wise sum of this NDArray and the ones given as parameters. The list of parameters can also contain scalar values - these will be added to all elements of the resulting array.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
addInplace
in interfaceNDArray<T extends Number>
- Parameters:
addends
- NDArrays and scalars to be added to this NDArray- Returns:
- this NDArray after addition
-
subtract
default ComplexNDArray<T> subtract(Object... substrahends)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the result of the element-wise substraction the parameter NDArrays and scalars from this NDArray. If list of parameters contains scalar values than these will be substracted from all elements of this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
-
subtractInplace
default ComplexNDArray<T> subtractInplace(Object... substrahends)
Description copied from interface:NDArray
Updates the elements this NDArray with the result of the element-wise subtraction the parameter NDArrays and scalars from this NDArray. If list of parameters contains scalar values than these will be substracted from all elements of this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
subtractInplace
in interfaceNDArray<T extends Number>
- Parameters:
substrahends
- NDArrays and scalars to be substracted from this NDArray- Returns:
- this NDArray after substraction
-
multiply
default ComplexNDArray<T> multiply(Object... multiplicands)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the element-wise product of this NDArray and the parameter NDArrays and scalars. If list of parameters contains scalar values than these will be multiplied to all elements of the resulting array.Note: The type of this NDArray determines type of the resulting NDArray.
-
multiplyInplace
default ComplexNDArray<T> multiplyInplace(Object... multiplicands)
Description copied from interface:NDArray
Updates the elements of this NDArray with the element-wise product of this NDArray and the parameter NDArrays and scalars. If list of parameters contains scalar values than these will be multiplied to all elements of the resulting array.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
multiplyInplace
in interfaceNDArray<T extends Number>
- Parameters:
multiplicands
- NDArrays and scalars to be multiplied with this NDArray- Returns:
- this NDArray after multiplication
-
divide
default ComplexNDArray<T> divide(Object... divisors)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the result of the element-wise division of this NDArray by the parameter NDArrays and scalars. If list of parameters contains scalar values than all elements of this NDArray will be divided by them.Note: The type of this NDArray determines type of the resulting NDArray.
-
divideInplace
default ComplexNDArray<T> divideInplace(Object... divisors)
Description copied from interface:NDArray
Updates the elements this NDArray with the result of the element-wise division of this NDArray by the parameter NDArrays and scalars. If list of parameters contains scalar values than all elements of this NDArray will be divided by them.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
divideInplace
in interfaceNDArray<T extends Number>
- Parameters:
divisors
- divisors of this NDArray- Returns:
- this NDArray after division
-
add
default ComplexNDArray<T> add(NDArray<?> addend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the element-wise sum of this NDArray and the NDArray given as parameter.Note: The type of this NDArray determines type of the resulting NDArray.
-
addInplace
default ComplexNDArray<T> addInplace(NDArray<?> addend)
Description copied from interface:NDArray
Updates this NDArray with the element-wise sum of this NDArray and the one given as parameter.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
addInplace
in interfaceNDArray<T extends Number>
- Parameters:
addend
- NDArray to be added to this NDArray- Returns:
- this NDArray after addition
-
subtract
default ComplexNDArray<T> subtract(NDArray<?> substrahend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the element-wise subtraction of the given NDArray from this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
-
subtractInplace
default ComplexNDArray<T> subtractInplace(NDArray<?> substrahend)
Description copied from interface:NDArray
Updates this NDArray with the element-wise subtraction of the given NDArray from this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
subtractInplace
in interfaceNDArray<T extends Number>
- Parameters:
substrahend
- NDArray to be subtracted from this NDArray- Returns:
- this NDArray after subtraction
-
multiply
default ComplexNDArray<T> multiply(NDArray<?> multiplicand)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the element-wise product of this NDArray and the NDArray given as parameter.Note: The type of this NDArray determines type of the resulting NDArray.
-
multiplyInplace
default ComplexNDArray<T> multiplyInplace(NDArray<?> multiplicand)
Description copied from interface:NDArray
Updates the elements of this NDArray with the element-wise product of this NDArray and the NDArray given as parameter.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
multiplyInplace
in interfaceNDArray<T extends Number>
- Parameters:
multiplicand
- NDArray to be multiplied with this NDArray- Returns:
- this NDArray after multiplication
-
divide
default ComplexNDArray<T> divide(NDArray<?> divisor)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the element-wise division of this NDArray and the NDArray given as parameter.Note: The type of this NDArray determines type of the resulting NDArray.
-
divideInplace
default ComplexNDArray<T> divideInplace(NDArray<?> divisor)
Description copied from interface:NDArray
Updates the elements this NDArray with the element-wise division of this NDArray and the NDArray given as parameter.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
divideInplace
in interfaceNDArray<T extends Number>
- Parameters:
divisor
- divisor of this NDArray- Returns:
- this NDArray after division
-
add
default ComplexNDArray<T> add(byte addend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
add
default ComplexNDArray<T> add(short addend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
add
default ComplexNDArray<T> add(int addend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
add
default ComplexNDArray<T> add(long addend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
add
default ComplexNDArray<T> add(float addend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
add
default ComplexNDArray<T> add(double addend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray incremented by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
addInplace
default ComplexNDArray<T> addInplace(byte addend)
Description copied from interface:NDArray
Updates this NDArray by incrementing all entries with the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
addInplace
in interfaceNDArray<T extends Number>
- Parameters:
addend
- scalar value to be added to each element of the NDArray- Returns:
- this NDArray after addition
-
addInplace
default ComplexNDArray<T> addInplace(short addend)
Description copied from interface:NDArray
Updates this NDArray by incrementing all entries with the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
addInplace
in interfaceNDArray<T extends Number>
- Parameters:
addend
- scalar value to be added to each element of the NDArray- Returns:
- this NDArray after addition
-
addInplace
default ComplexNDArray<T> addInplace(int addend)
Description copied from interface:NDArray
Updates this NDArray by incrementing all entries with the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
addInplace
in interfaceNDArray<T extends Number>
- Parameters:
addend
- scalar value to be added to each element of the NDArray- Returns:
- this NDArray after addition
-
addInplace
default ComplexNDArray<T> addInplace(long addend)
Description copied from interface:NDArray
Updates this NDArray by incrementing all entries with the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
addInplace
in interfaceNDArray<T extends Number>
- Parameters:
addend
- scalar value to be added to each element of the NDArray- Returns:
- this NDArray after addition
-
addInplace
default ComplexNDArray<T> addInplace(float addend)
Description copied from interface:NDArray
Updates this NDArray by incrementing all entries with the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
addInplace
in interfaceNDArray<T extends Number>
- Parameters:
addend
- scalar value to be added to each element of the NDArray- Returns:
- this NDArray after addition
-
addInplace
default ComplexNDArray<T> addInplace(double addend)
Description copied from interface:NDArray
Updates this NDArray by incrementing all entries with the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
addInplace
in interfaceNDArray<T extends Number>
- Parameters:
addend
- scalar value to be added to each element of the NDArray- Returns:
- this NDArray after addition
-
subtract
default ComplexNDArray<T> subtract(byte substrahend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
subtract
default ComplexNDArray<T> subtract(short substrahend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
subtract
default ComplexNDArray<T> subtract(int substrahend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
subtract
default ComplexNDArray<T> subtract(long substrahend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
subtract
default ComplexNDArray<T> subtract(float substrahend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
subtract
default ComplexNDArray<T> subtract(double substrahend)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray minus the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
subtractInplace
default ComplexNDArray<T> subtractInplace(byte substrahend)
Description copied from interface:NDArray
Updates this NDArray by subtracting the given value from all entries of this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
subtractInplace
in interfaceNDArray<T extends Number>
- Parameters:
substrahend
- scalar value to be subtracted from each element of the NDArray- Returns:
- this NDArray after subtraction
-
subtractInplace
default ComplexNDArray<T> subtractInplace(short substrahend)
Description copied from interface:NDArray
Updates this NDArray by subtracting the given value from all entries of this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
subtractInplace
in interfaceNDArray<T extends Number>
- Parameters:
substrahend
- scalar value to be subtracted from each element of the NDArray- Returns:
- this NDArray after subtraction
-
subtractInplace
default ComplexNDArray<T> subtractInplace(int substrahend)
Description copied from interface:NDArray
Updates this NDArray by subtracting the given value from all entries of this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
subtractInplace
in interfaceNDArray<T extends Number>
- Parameters:
substrahend
- scalar value to be subtracted from each element of the NDArray- Returns:
- this NDArray after subtraction
-
subtractInplace
default ComplexNDArray<T> subtractInplace(long substrahend)
Description copied from interface:NDArray
Updates this NDArray by subtracting the given value from all entries of this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
subtractInplace
in interfaceNDArray<T extends Number>
- Parameters:
substrahend
- scalar value to be subtracted from each element of the NDArray- Returns:
- this NDArray after subtraction
-
subtractInplace
default ComplexNDArray<T> subtractInplace(float substrahend)
Description copied from interface:NDArray
Updates this NDArray by subtracting the given value from all entries of this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
subtractInplace
in interfaceNDArray<T extends Number>
- Parameters:
substrahend
- scalar value to be subtracted from each element of the NDArray- Returns:
- this NDArray after subtraction
-
subtractInplace
default ComplexNDArray<T> subtractInplace(double substrahend)
Description copied from interface:NDArray
Updates this NDArray by subtracting the given value from all entries of this NDArray.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
subtractInplace
in interfaceNDArray<T extends Number>
- Parameters:
substrahend
- scalar value to be subtracted from each element of the NDArray- Returns:
- this NDArray after subtraction
-
multiply
default ComplexNDArray<T> multiply(byte multiplicand)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
multiply
default ComplexNDArray<T> multiply(short multiplicand)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
multiply
default ComplexNDArray<T> multiply(int multiplicand)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
multiply
default ComplexNDArray<T> multiply(long multiplicand)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
multiply
default ComplexNDArray<T> multiply(float multiplicand)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
multiply
default ComplexNDArray<T> multiply(double multiplicand)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
multiplyInplace
default ComplexNDArray<T> multiplyInplace(byte multiplicand)
Description copied from interface:NDArray
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
multiplyInplace
in interfaceNDArray<T extends Number>
- Parameters:
multiplicand
- scalar value with which each element of the NDArray are multiplied- Returns:
- this NDArray after multiplication
-
multiplyInplace
default ComplexNDArray<T> multiplyInplace(short multiplicand)
Description copied from interface:NDArray
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
multiplyInplace
in interfaceNDArray<T extends Number>
- Parameters:
multiplicand
- scalar value with which each element of the NDArray are multiplied- Returns:
- this NDArray after multiplication
-
multiplyInplace
default ComplexNDArray<T> multiplyInplace(int multiplicand)
Description copied from interface:NDArray
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
multiplyInplace
in interfaceNDArray<T extends Number>
- Parameters:
multiplicand
- scalar value with which each element of the NDArray are multiplied- Returns:
- this NDArray after multiplication
-
multiplyInplace
default ComplexNDArray<T> multiplyInplace(long multiplicand)
Description copied from interface:NDArray
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
multiplyInplace
in interfaceNDArray<T extends Number>
- Parameters:
multiplicand
- scalar value with which each element of the NDArray are multiplied- Returns:
- this NDArray after multiplication
-
multiplyInplace
default ComplexNDArray<T> multiplyInplace(float multiplicand)
Description copied from interface:NDArray
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
multiplyInplace
in interfaceNDArray<T extends Number>
- Parameters:
multiplicand
- scalar value with which each element of the NDArray are multiplied- Returns:
- this NDArray after multiplication
-
multiplyInplace
default ComplexNDArray<T> multiplyInplace(double multiplicand)
Description copied from interface:NDArray
Updates the elements of this NDArray with the values of this NDArray multiplied by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
multiplyInplace
in interfaceNDArray<T extends Number>
- Parameters:
multiplicand
- scalar value with which each element of the NDArray are multiplied- Returns:
- this NDArray after multiplication
-
divide
default ComplexNDArray<T> divide(byte divisor)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
divide
default ComplexNDArray<T> divide(short divisor)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
divide
default ComplexNDArray<T> divide(int divisor)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
divide
default ComplexNDArray<T> divide(long divisor)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
divide
default ComplexNDArray<T> divide(float divisor)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
divide
default ComplexNDArray<T> divide(double divisor)
Description copied from interface:NDArray
Creates a new NDArray of the same shape and fills it with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
-
divideInplace
default ComplexNDArray<T> divideInplace(byte divisor)
Description copied from interface:NDArray
Updates the elements this NDArray with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
divideInplace
in interfaceNDArray<T extends Number>
- Parameters:
divisor
- scalar value with which each element of the NDArray are divided- Returns:
- this NDArray after division
-
divideInplace
default ComplexNDArray<T> divideInplace(short divisor)
Description copied from interface:NDArray
Updates the elements this NDArray with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
divideInplace
in interfaceNDArray<T extends Number>
- Parameters:
divisor
- scalar value with which each element of the NDArray are divided- Returns:
- this NDArray after division
-
divideInplace
default ComplexNDArray<T> divideInplace(int divisor)
Description copied from interface:NDArray
Updates the elements this NDArray with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
divideInplace
in interfaceNDArray<T extends Number>
- Parameters:
divisor
- scalar value with which each element of the NDArray are divided- Returns:
- this NDArray after division
-
divideInplace
default ComplexNDArray<T> divideInplace(long divisor)
Description copied from interface:NDArray
Updates the elements this NDArray with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
divideInplace
in interfaceNDArray<T extends Number>
- Parameters:
divisor
- scalar value with which each element of the NDArray are divided- Returns:
- this NDArray after division
-
divideInplace
default ComplexNDArray<T> divideInplace(float divisor)
Description copied from interface:NDArray
Updates the elements this NDArray with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
divideInplace
in interfaceNDArray<T extends Number>
- Parameters:
divisor
- scalar value with which each element of the NDArray are divided- Returns:
- this NDArray after division
-
divideInplace
default ComplexNDArray<T> divideInplace(double divisor)
Description copied from interface:NDArray
Updates the elements this NDArray with the values of this NDArray divided by the given value.Note: The type of this NDArray determines type of the resulting NDArray.
- Specified by:
divideInplace
in interfaceNDArray<T extends Number>
- Parameters:
divisor
- scalar value with which each element of the NDArray are divided- Returns:
- this NDArray after division
-
sum
default ComplexNDArray<T> sum(int... selectedDims)
Description copied from interface:NDArray
Returns the sum of all elements along the specified dimensions in this NDArray.For example, if
A
is a [5 × 8 × 3] array, thenB = A.sum(2)
returns a [5 × 8] array, andB.get(1,1) == A.get(1,1,0) + A.get(1,1,1) + A.get(1,1,2)
.
-
prod
default ComplexNDArray<T> prod(int... selectedDims)
Description copied from interface:NDArray
Returns the product of all elements along the specified dimensions in this NDArray.For example, if
A
is a [5 × 8 × 3] array, thenB = A.prod(2)
returns a [5 × 8] array, andB.get(1,1) == A.get(1,1,0) * A.get(1,1,1) * A.get(1,1,2)
.
-
accumulate
default ComplexNDArray<T> accumulate(BinaryOperator<org.apache.commons.math3.complex.Complex> func, int... selectedDims)
Description copied from interface:NDArray
Returns the accumulation of all elements along the specified dimensions in this NDArray.For example, if
A
is a [5 × 8 × 3] array, thenB = A.accumulate(func, 2)
returns a [5 × 8] array, andB.get(1,1) == func(func(A.get(1,1,0), A.get(1,1,1)), A.get(1,1,2))
.- Specified by:
accumulate
in interfaceNDArray<T extends Number>
- Parameters:
func
- accumulation function that accepts two elements and returns accumulation resultselectedDims
- dimensions along which the accumulation should be performed- Returns:
- result of accumulation of all elements along the specified dimensions
-
reduceComplexSlices
default ComplexNDArray<T> reduceComplexSlices(BiFunction<ComplexNDArray<T>,int[],org.apache.commons.math3.complex.Complex> func, int... selectedDims)
Reduces slices along the specified dimensions in this NDArray to scalar values, reducing the number of dimensions.For example, if
A
is a [5 × 8 × 3] array, thenB = A.reduce(func, 2)
returns a [5 × 8] array, andB.get(1,1) == func(A.slice(1, 1, ":"), new int[] { 1, 1 })
.- Parameters:
func
- reduction function that accepts a slice and its index and returns reduction resultselectedDims
- dimensions along which the reduction should be performed- Returns:
- result of reduction of all slices along the specified dimensions
-
fill
default ComplexNDArray<T> fill(double value)
Fill this NDArray with the specified value
-
fill
default ComplexNDArray<T> fill(T value)
Fill this NDArray with the specified value- Parameters:
value
- value assigned to all elements of this NDArray- Returns:
- this NDArray
-
fill
default ComplexNDArray<T> fill(org.apache.commons.math3.complex.Complex value)
Fill this NDArray with the specified value
-
similar
ComplexNDArray<T> similar()
Description copied from interface:NDArray
Returns a new array of the same shape as this NDArray filled with zeros.
-
copy
ComplexNDArray<T> copy()
Description copied from interface:NDArray
Returns a copy of this NDArray.
-
slice
default ComplexNDArray<T> slice(Object... slicingExpressions)
Description copied from interface:NDArray
Returns an array view referencing this NDArray as parent that gives read-write access to a specific multi-dimensional slice of the array.View: An NDArray that references the specified region its parent array. All modifications in the parent array are reflected in the view, and vice versa.
Possible slicing expressions:
- integer values: selects a specific slice along the positionally selected dimension
- range (string that consists of two integer values specifying the start and the end of the range separated by a colon): selects a specific range of slices along the positionally selected dimension
- all-range (string literal ":" or Range.ALL): selects all slices along the positionally selected dimension
For example, if
A
is a [5 × 8 × 3] array, thenB = A.slice(1, "2:5", ":")
returns a [3 × 3] array, andB.get(1,1) == A.get(1,3,1)
.
-
mask
default ComplexNDArray<T> mask(NDArray<?> mask)
Description copied from interface:NDArray
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements of the array selected by the given mask. The mask must have the same shape as this array, and those entries are selected which has the same indices as the non-zero entries in the mask. In other words: All places where the mask contains a zero value are skipped, and all other values are copied into a new vector.
-
mask
default ComplexNDArray<T> mask(Predicate<org.apache.commons.math3.complex.Complex> func)
Description copied from interface:NDArray
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements for which the given function returns true.
-
maskWithLinearIndices
default ComplexNDArray<T> maskWithLinearIndices(BiPredicate<org.apache.commons.math3.complex.Complex,Integer> func)
Description copied from interface:NDArray
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements for which the given function returns true.- Specified by:
maskWithLinearIndices
in interfaceNDArray<T extends Number>
- Parameters:
func
- function that accepts the values of entries and their linear indices as input and returns boolean- Returns:
- an array view that gives read-write access to a specific elements for which the given function returns true
-
maskWithCartesianIndices
default ComplexNDArray<T> maskWithCartesianIndices(BiPredicate<org.apache.commons.math3.complex.Complex,int[]> func)
Description copied from interface:NDArray
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements for which the given function returns true.- Specified by:
maskWithCartesianIndices
in interfaceNDArray<T extends Number>
- Parameters:
func
- function that accepts the values of entries and their Cartesian indices as input and returns boolean- Returns:
- an array view that gives read-write access to a specific elements for which the given function returns true
-
inverseMask
default ComplexNDArray<T> inverseMask(NDArray<?> mask)
Description copied from interface:NDArray
Returns an array view referencing this NDArray as parent that gives read-write access to a specific elements of the array selected by the given inverseMask. The inverseMask must have the same shape as this array, and those entries are selected which has the same indices as the non-zero entries in the inverseMask. In other words: All places where the inverseMask contains a zero value are skipped, and all other values are copied into a new vector.- Specified by:
inverseMask
in interfaceNDArray<T extends Number>
- Parameters:
mask
- NDArray in which non-zero entries marks elements to keep- Returns:
- an array view that gives read-write access to a specific elements of the array selected by the given inverseMask
-
permuteDims
default ComplexNDArray<T> permuteDims(int... permutation)
Description copied from interface:NDArray
Returns a view that references this NDArray as parent, but the order of dimensions are swiched in this view.View: An NDArray that references the specified region its parent array. All modifications in the parent array are reflected in the view, and vice versa.
For example, if
A
is a [5 × 8 × 3] array, thenB = A.permuteDims(1, 0, 2)
returns a [8 × 5 × 3] array, andB.get(3,1,0) == A.get(1,3,0)
.- Specified by:
permuteDims
in interfaceNDArray<T extends Number>
- Parameters:
permutation
- new order of dimensions / permutation vector- Returns:
- a view that references this NDArray as parent, but the order of dimensions are swiched in this view.
-
reshape
default ComplexNDArray<T> reshape(int... newShape)
Description copied from interface:NDArray
Returns a view that references this NDArray as parent but has a different shape.View: An NDArray that references the specified region its parent array. All modifications in the parent array are reflected in the view, and vice versa.
For example, if
A
is a [5 × 8 × 3] array, thenB = A.reshape(40, 3)
returns a [40 × 3] array, andB.get(10) == B.get(10,0) == A.get(1,0,0) == A.get(10)
.Note: the linear indexing of the two arrays remain the same, and the corresponding cartesian indices determined by column-first ordering.
-
concatenate
default ComplexNDArray<T> concatenate(int axis, NDArray<?>... arrays)
Description copied from interface:NDArray
Creates a new NDArray that contains the elements of this NDArrays and all other NDArrays concatenated along the dimension/axis specified by the first parameter.- Specified by:
concatenate
in interfaceNDArray<T extends Number>
- Parameters:
axis
- Axis/dimension along which the concatenation should occur.arrays
- Arrays to be concatenated to this NDArray.- Returns:
- a new NDArray that contains the elements of this NDArrays and all other NDArrays concatenated along the dimension/axis specified by the first parameter.
-
selectDims
default ComplexNDArray<T> selectDims(int... selectedDims)
Description copied from interface:NDArray
Returns a view that references this NDArray as parent, and skips all singleton dimensions not included in the parameter list.View: An NDArray that references the specified region its parent array. All modifications in the parent array are reflected in the view, and vice versa.
Singleton dimension: dimension of shape 1.
- Specified by:
selectDims
in interfaceNDArray<T extends Number>
- Parameters:
selectedDims
- dimensions kept in the returned view- Returns:
- a view that references this NDArray as parent, and skips all singleton dimensions not included in the parameter list
-
dropDims
default ComplexNDArray<T> dropDims(int... selectedDims)
Description copied from interface:NDArray
Returns a view that references this NDArray as parent, and skips all singleton dimensions included in the parameter list.View: An NDArray that references the specified region its parent array. All modifications in the parent array are reflected in the view, and vice versa.
Singleton dimension: dimension of shape 1.
-
squeeze
default ComplexNDArray<T> squeeze()
Description copied from interface:NDArray
Returns a view that references this NDArray as parent, and skips all singleton dimensions.View: An NDArray that references the specified region its parent array. All modifications in the parent array are reflected in the view, and vice versa.
Singleton dimension: dimension of shape 1.
-
-