api / koma.extensions / forEachIndexed
forEachIndexed
@JvmName("forEachIndexedDouble") inline fun
Matrix
<
Double
>.forEachIndexed(f: (row:
Int
, col:
Int
, ele:
Double
) ->
Unit
):
Unit
@JvmName("forEachIndexedFloat") inline fun
Matrix
<
Float
>.forEachIndexed(f: (row:
Int
, col:
Int
, ele:
Float
) ->
Unit
):
Unit
@JvmName("forEachIndexedGeneric") fun <T>
Matrix
<
T
>.forEachIndexed(f: (row:
Int
, col:
Int
, ele:
T
) ->
Unit
):
Unit
@JvmName("forEachIndexedInt") inline fun
Matrix
<
Int
>.forEachIndexed(f: (row:
Int
, col:
Int
, ele:
Int
) ->
Unit
):
Unit
Passes each element in row major order into a function along with its index location.
Parameters
f
- A function that takes in a row,col position and an element value@JvmName("forEachIndexedByte") inline fun
NDArray
<
Byte
>.forEachIndexed(f: (idx:
Int
, ele:
Byte
) ->
Unit
):
Unit
@JvmName("forEachIndexedDouble") inline fun
NDArray
<
Double
>.forEachIndexed(f: (idx:
Int
, ele:
Double
) ->
Unit
):
Unit
@JvmName("forEachIndexedFloat") inline fun
NDArray
<
Float
>.forEachIndexed(f: (idx:
Int
, ele:
Float
) ->
Unit
):
Unit
@JvmName("forEachIndexedGeneric") fun <T>
NDArray
<
T
>.forEachIndexed(f: (idx:
Int
, ele:
T
) ->
Unit
):
Unit
@JvmName("forEachIndexedInt") inline fun
NDArray
<
Int
>.forEachIndexed(f: (idx:
Int
, ele:
Int
) ->
Unit
):
Unit
@JvmName("forEachIndexedLong") inline fun
NDArray
<
Long
>.forEachIndexed(f: (idx:
Int
, ele:
Long
) ->
Unit
):
Unit
@JvmName("forEachIndexedShort") inline fun
NDArray
<
Short
>.forEachIndexed(f: (idx:
Int
, ele:
Short
) ->
Unit
):
Unit
Takes each element in a NDArray and passes them through f. Index given to f is a linear index, depending on the underlying storage major dimension.
Parameters
f
- A function that takes in an element. Function also takes
in the linear index of the element's location.