Port MATLAB bounding ellipsoid code to Python
问题 MATLAB code exists to find the so-called "minimum volume enclosing ellipsoid" (e.g. here, also here). I'll paste the relevant part for convenience: function [A , c] = MinVolEllipse(P, tolerance) [d N] = size(P); Q = zeros(d+1,N); Q(1:d,:) = P(1:d,1:N); Q(d+1,:) = ones(1,N); count = 1; err = 1; u = (1/N) * ones(N,1); while err > tolerance, X = Q * diag(u) * Q'; M = diag(Q' * inv(X) * Q); [maximum j] = max(M); step_size = (maximum - d -1)/((d+1)*(maximum-1)); new_u = (1 - step_size)*u ; new_u(j