Closed drmoose closed 5 years ago
This PR introduces an array-reshaping function, loosely inspired by the one from numpy. reshape comes in two flavors:
reshape
NDArray<Double>.reshape(Int, Int): Matrix<Double>
NDArray<T>.reshape(vararg Int): NDArray<T>
Reshape uses the same row-major ordering as getLinear, and uses the code-generation gradle scripts to avoid boxing and reflection.
This PR also fixes a type inference bug I introduced in a previous PR, which stood in the way.
This PR introduces an array-reshaping function, loosely inspired by the one from numpy.
reshape
comes in two flavors:NDArray<Double>.reshape(Int, Int): Matrix<Double>
is defined for Int and Float as well, allowing 2d reshape requests to return a matrix when possible.NDArray<T>.reshape(vararg Int): NDArray<T>
catches the remaining cases.Reshape uses the same row-major ordering as getLinear, and uses the code-generation gradle scripts to avoid boxing and reflection.
This PR also fixes a type inference bug I introduced in a previous PR, which stood in the way.