From a2cc1c39307c70c073038d79e17346e962720024 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Mon, 19 Sep 2022 13:50:48 -0700 Subject: DEP: fastCopyAndTranspose and PyArray_CopyAndTranspose Deprecate the fastCopyAndTranspose function from the Python API, and the underlying PyArray_CopyAndTranspose function from the C-API. Also removes an internal, private function _fastCopyAndTranspose which was the original Python wrapper around the C-function. --- numpy/linalg/linalg.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'numpy/linalg') diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 6d7dda2b6..6f3400450 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -21,7 +21,7 @@ import warnings from numpy.core import ( array, asarray, zeros, empty, empty_like, intc, single, double, csingle, cdouble, inexact, complexfloating, newaxis, all, Inf, dot, - add, multiply, sqrt, fastCopyAndTranspose, sum, isfinite, + add, multiply, sqrt, sum, isfinite, finfo, errstate, geterrobj, moveaxis, amin, amax, product, abs, atleast_2d, intp, asanyarray, object_, matmul, swapaxes, divide, count_nonzero, isnan, sign, argsort, sort, @@ -158,10 +158,6 @@ def _commonType(*arrays): return t, result_type -# _fastCopyAndTranpose assumes the input is 2D (as all the calls in here are). - -_fastCT = fastCopyAndTranspose - def _to_native_byte_order(*arrays): ret = [] for arr in arrays: @@ -174,12 +170,13 @@ def _to_native_byte_order(*arrays): else: return ret + def _fastCopyAndTranspose(type, *arrays): cast_arrays = () for a in arrays: if a.dtype.type is not type: a = a.astype(type) - cast_arrays = cast_arrays + (_fastCT(a),) + cast_arrays = cast_arrays + (a.T.copy(),) if len(cast_arrays) == 1: return cast_arrays[0] else: @@ -1172,7 +1169,7 @@ def eigvalsh(a, UPLO='L'): def _convertarray(a): t, result_t = _commonType(a) - a = _fastCT(a.astype(t)) + a = a.astype(t).T.copy() return a, t, result_t -- cgit v1.2.1