api / koma.extensions / mapIndexedN


@JvmName("mapIndexedNByte") inline funNDArray<Byte>.mapIndexedN(f: (idx:IntArray, ele:Byte) ->Byte):NDArray<Byte> @JvmName("mapIndexedNDouble") inline funNDArray<Double>.mapIndexedN(f: (idx:IntArray, ele:Double) ->Double):NDArray<Double> @JvmName("mapIndexedNFloat") inline funNDArray<Float>.mapIndexedN(f: (idx:IntArray, ele:Float) ->Float):NDArray<Float> @JvmName("mapIndexedNGeneric") fun <T>NDArray<T>.mapIndexedN(f: (idx:IntArray, ele:T) ->T):NDArray<T> @JvmName("mapIndexedNInt") inline funNDArray<Int>.mapIndexedN(f: (idx:IntArray, ele:Int) ->Int):NDArray<Int> @JvmName("mapIndexedNLong") inline funNDArray<Long>.mapIndexedN(f: (idx:IntArray, ele:Long) ->Long):NDArray<Long> @JvmName("mapIndexedNShort") inline funNDArray<Short>.mapIndexedN(f: (idx:IntArray, ele:Short) ->Short):NDArray<Short>

Takes each element in a NDArray, passes them through f, and puts the output of f into an output NDArray. Index given to f is the full ND index of the element.


f - A function that takes in an element and returns an element. Function also takes in the ND index of the element's location.

Return the new NDArray after each element is mapped through f