api / koma.extensions / mapIndexed
mapIndexed
@JvmName("mapIndexedDouble") inline fun
Matrix
<
Double
>.mapIndexed(f: (row:
Int
, col:
Int
, ele:
Double
) ->
Double
):
Matrix
<
Double
>
@JvmName("mapIndexedFloat") inline fun
Matrix
<
Float
>.mapIndexed(f: (row:
Int
, col:
Int
, ele:
Float
) ->
Float
):
Matrix
<
Float
>
@JvmName("mapIndexedGeneric") fun <T>
Matrix
<
T
>.mapIndexed(f: (row:
Int
, col:
Int
, ele:
T
) ->
T
):
Matrix
<
T
>
@JvmName("mapIndexedInt") inline fun
Matrix
<
Int
>.mapIndexed(f: (row:
Int
, col:
Int
, ele:
Int
) ->
Int
):
Matrix
<
Int
>
Takes each element in a matrix, passes them through f, and puts the output of f into an output matrix. This process is done in row-major order.
Parameters
f
- A function that takes in an element and returns an element. Function also takes
in the row, col index of the element's location.
Return the new matrix after each element is mapped through f
@JvmName("mapIndexedByte") inline fun
NDArray
<
Byte
>.mapIndexed(f: (idx:
Int
, ele:
Byte
) ->
Byte
):
NDArray
<
Byte
>
@JvmName("mapIndexedDouble") inline fun
NDArray
<
Double
>.mapIndexed(f: (idx:
Int
, ele:
Double
) ->
Double
):
NDArray
<
Double
>
@JvmName("mapIndexedFloat") inline fun
NDArray
<
Float
>.mapIndexed(f: (idx:
Int
, ele:
Float
) ->
Float
):
NDArray
<
Float
>
@JvmName("mapIndexedGeneric") fun <T>
NDArray
<
T
>.mapIndexed(f: (idx:
Int
, ele:
T
) ->
T
):
DefaultGenericNDArray
<
T
>
@JvmName("mapIndexedInt") inline fun
NDArray
<
Int
>.mapIndexed(f: (idx:
Int
, ele:
Int
) ->
Int
):
NDArray
<
Int
>
@JvmName("mapIndexedLong") inline fun
NDArray
<
Long
>.mapIndexed(f: (idx:
Int
, ele:
Long
) ->
Long
):
NDArray
<
Long
>
@JvmName("mapIndexedShort") inline fun
NDArray
<
Short
>.mapIndexed(f: (idx:
Int
, 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 a linear index, depending on the underlying storage major dimension.
Parameters
f
- A function that takes in an element and returns an element. Function also takes
in the linear index of the element's location.
Return the new NDArray after each element is mapped through f