api / koma.extensions / reshape
reshape
@JvmName("reshapeDouble") fun
NDArray
<
Double
>.reshape(rows:
Int
, cols:
Int
):
Matrix
<
Double
>
@JvmName("reshapeFloat") fun
NDArray
<
Float
>.reshape(rows:
Int
, cols:
Int
):
Matrix
<
Float
>
@JvmName("reshapeGeneric") inline fun <reified T>
Matrix
<
T
>.reshape(rows:
Int
, cols:
Int
):
Matrix
<
T
>
@JvmName("reshapeInt") fun
NDArray
<
Int
>.reshape(rows:
Int
, cols:
Int
):
Matrix
<
Int
>
Returns a new Matrix with the given shape, populated with the data in this array.
Parameters
rows
- The number of rows in the desired matrix
cols
- The number of columns in the desired matrix
Exceptions
IllegalArgumentException
- when rows * cols
does not equal size
Returns
A copy of the elements in this array, shaped to the given number of rows and columns,
such that this.toList() == this.reshape(rows, cols).toList()
@JvmName("reshapeByte") fun
NDArray
<
Byte
>.reshape(vararg dims:
Int
):
NDArray
<
Byte
>
@JvmName("reshapeDouble") fun
NDArray
<
Double
>.reshape(vararg dims:
Int
):
NDArray
<
Double
>
@JvmName("reshapeFloat") fun
NDArray
<
Float
>.reshape(vararg dims:
Int
):
NDArray
<
Float
>
@JvmName("reshapeGeneric") inline fun <reified T>
NDArray
<
T
>.reshape(vararg dims:
Int
):
NDArray
<
T
>
@JvmName("reshapeInt") fun
NDArray
<
Int
>.reshape(vararg dims:
Int
):
NDArray
<
Int
>
@JvmName("reshapeLong") fun
NDArray
<
Long
>.reshape(vararg dims:
Int
):
NDArray
<
Long
>
@JvmName("reshapeShort") fun
NDArray
<
Short
>.reshape(vararg dims:
Int
):
NDArray
<
Short
>
Returns a new NDArray with the given shape, populated with the data in this array.
Parameters
dims
- Desired dimensions of the output array.
Exceptions
IllegalArgumentException
- when the product of all of the given dims
does not equal size
Returns
A copy of the elements in this array, shaped to the given number of rows and columns,
such that this.toList() == this.reshape(*dims).toList()