api / koma.internal.default.generated.ndarray / DefaultIntNDArray
DefaultIntNDArray
open class DefaultIntNDArray :NDArray<Int>
An (unoptimized) implementation of NDArray in pure Kotlin, for portability between the different platforms koma supports.
Parameters
shape - A vararg specifying the size of each dimension, e.g. a 3D array with size 4x6x8 would pass in 4,6,8)
init - A function that takes a location in the new array and returns its initial value.
Constructors
| Name | Summary |
|---|---|
| <init> | DefaultIntNDArray(vararg shape:Int, init: (IntArray) ->Int)An (unoptimized) implementation of NDArray in pure Kotlin, for portability between the different platforms koma supports. |
Properties
| Name | Summary |
|---|---|
| shape | vararg val shape:IntArrayA vararg specifying the size of each dimension, e.g. a 3D array with size 4x6x8 would pass in 4,6,8) |
| size | open val size:Int |
Functions
| Name | Summary |
|---|---|
| copy | open fun copy():NDArray<Int> |
| getBaseArray | open fun getBaseArray():Any |
| getByte | open fun getByte(i:Int):Byte |
| getDouble | open fun getDouble(i:Int):Double |
| getFloat | open fun getFloat(i:Int):Float |
| getGeneric | open fun getGeneric(vararg indices:Int):Intopen fun getGeneric(i:Int):Int |
| getInt | open fun getInt(i:Int):Int |
| getLong | open fun getLong(i:Int):Long |
| getShort | open fun getShort(i:Int):Short |
| setByte | open fun setByte(i:Int, v:Byte):Unit |
| setDouble | open fun setDouble(i:Int, v:Double):Unit |
| setFloat | open fun setFloat(i:Int, v:Float):Unit |
| setGeneric | open fun setGeneric(i:Int, value:Int):Unitopen fun setGeneric(vararg indices:Int, value:Int):Unit |
| setInt | open fun setInt(i:Int, v:Int):Unit |
| setLong | open fun setLong(i:Int, v:Long):Unit |
| setShort | open fun setShort(i:Int, v:Short):Unit |
| shape | open fun shape():List<Int> |
Inherited Functions
| Name | Summary |
|---|---|
| getByte | open fun getByte(vararg indices:Int):Byte |
| getDouble | open fun getDouble(vararg indices:Int):Double |
| getFloat | open fun getFloat(vararg indices:Int):Float |
| getInt | open fun getInt(vararg indices:Int):Int |
| getLinear | open fun ~~getLinear~~(index:Int):T |
| getLong | open fun getLong(vararg indices:Int):Long |
| getShort | open fun getShort(vararg indices:Int):Short |
| iterateIndices | open fun iterateIndices():Iterable<IndexIterator> |
| setByte | open fun setByte(vararg indices:Int, v:Byte):Unit |
| setDouble | open fun setDouble(vararg indices:Int, v:Double):Unit |
| setFloat | open fun setFloat(vararg indices:Int, v:Float):Unit |
| setInt | open fun setInt(vararg indices:Int, v:Int):Unit |
| setLinear | open fun ~~setLinear~~(index:Int, value:T):Unit |
| setLong | open fun setLong(vararg indices:Int, v:Long):Unit |
| setShort | open fun setShort(vararg indices:Int, v:Short):Unit |
| toIterable | open fun toIterable():Iterable<T> |
| toList | open fun toList():List<T>Converts this NDArray into a one-dimensional List in row-major order. |
| toMutableList | open fun toMutableList():MutableList<T>Converts this NDArray into a one-dimensional MutableList in row-major order. |
Extension Functions
| Name | Summary |
|---|---|
| checkIndices | fun <T>NDArray<T>.checkIndices(indices:IntArray):IntArray |
| checkLinearIndex | fun <T>NDArray<T>.checkLinearIndex(index:Int):Int |
| div | operator funNDArray<Int>.div(other:Int):NDArray<Int> |
| fill | fun <T>NDArray<T>.fill(f: (idx:IntArray) ->T):NDArray<T>funNDArray<Int>.fill(f: (idx:IntArray) ->Int):NDArray<Int> |
| fillBoth | fun <T>NDArray<T>.fillBoth(f: (nd:IntArray, linear:Int) ->T):NDArray<T>funNDArray<Int>.fillBoth(f: (nd:IntArray, linear:Int) ->Int):NDArray<Int> |
| fillLinear | fun <T>NDArray<T>.fillLinear(f: (idx:Int) ->T):NDArray<T>funNDArray<Int>.fillLinear(f: (idx:Int) ->Int):NDArray<Int> |
| forEach | fun <T>NDArray<T>.forEach(f: (ele:T) ->Unit):UnitfunNDArray<Int>.forEach(f: (ele:Int) ->Unit):UnitTakes each element in a NDArray and passes them through f. |
| forEachIndexed | fun <T>NDArray<T>.forEachIndexed(f: (idx:Int, ele:T) ->Unit):UnitfunNDArray<Int>.forEachIndexed(f: (idx:Int, ele:Int) ->Unit):UnitTakes 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. |
| forEachIndexedN | fun <T>NDArray<T>.forEachIndexedN(f: (idx:IntArray, ele:T) ->Unit):UnitfunNDArray<Int>.forEachIndexedN(f: (idx:IntArray, ele:Int) ->Unit):UnitTakes each element in a NDArray and passes them through f. Index given to f is the full ND index of the element. |
| linearToNIdx | fun <T>NDArray<T>.linearToNIdx(linear:Int):IntArrayGiven the 1D index of an element in the underlying storage, find the corresponding ND index. Inverse of nIdxToLinear. |
| map | fun <T>NDArray<T>.map(f: (T) ->T):DefaultGenericNDArray<T>funNDArray<Int>.map(f: (Int) ->Int):NDArray<Int>Takes each element in a NDArray, passes them through f, and puts the output of f into an output NDArray. |
| mapIndexed | fun <T>NDArray<T>.mapIndexed(f: (idx:Int, ele:T) ->T):DefaultGenericNDArray<T>funNDArray<Int>.mapIndexed(f: (idx:Int, ele:Int) ->Int):NDArray<Int>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. |
| mapIndexedN | fun <T>NDArray<T>.mapIndexedN(f: (idx:IntArray, ele:T) ->T):NDArray<T>funNDArray<Int>.mapIndexedN(f: (idx:IntArray, ele:Int) ->Int):NDArray<Int>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. |
| minus | operator funNDArray<Int>.minus(other:Int):NDArray<Int>operator funNDArray<Int>.minus(other:NDArray<Int>):NDArray<Int> |
| nIdxToLinear | fun <T>NDArray<T>.nIdxToLinear(indices:IntArray):IntGiven a ND index into this array, find the corresponding 1D index in the raw underlying 1D storage array. |
| plus | operator funNDArray<Int>.plus(other:Int):NDArray<Int>operator funNDArray<Int>.plus(other:NDArray<Int>):NDArray<Int> |
| pow | infix funNDArray<Int>.pow(exponent:Int):NDArray<Int> |
| reshape | funNDArray<Int>.reshape(rows:Int, cols:Int):Matrix<Int>Returns a new Matrix with the given shape, populated with the data in this array. |
| safeNIdxToLinear | fun <T>NDArray<T>.safeNIdxToLinear(indices:IntArray):Int |
| set | operator fun <T>NDArray<T>.set(vararg indices:Int, value:NDArray<T>):Unitoperator fun <T>NDArray<T>.set(vararg indices:Int, value:T):Unitoperator funNDArray<Int>.set(vararg indices:Int, value:NDArray<Int>):Unitoperator funNDArray<Int>.set(vararg indices:Int, value:Int):Unit |
| times | operator funNDArray<Int>.times(other:NDArray<Int>):NDArray<Int>operator funNDArray<Int>.times(other:Int):NDArray<Int> |
| toIntArray | funNDArray<Int>.toIntArray():IntArrayConverts this NDArray into a one-dimensional IntArray in row-major order. |
| toMatrix | funNDArray<Int>.toMatrix():Matrix<Int> |
| toMatrixOrNull | fun <T>NDArray<T>.toMatrixOrNull():Matrix<T>? |
| toTypedArray | fun <T>NDArray<T>.toTypedArray():Array<T>Converts this NDArray into a one-dimensional Array in row-major order. |
| unaryMinus | operator funNDArray<Int>.unaryMinus():NDArray<Int> |
| widthOfDims | fun <T>NDArray<T>.widthOfDims():ArrayList<Int> |