Hi Bruno. I don't think the rank of A is the issue, because even in the following example where A is the simplest full rank matrix you can get, the same problem happens:

>> spherelsq(eye(2),[0;0],sqrt(2))

ans =

0
0

I think the real issue is that when b=0, the problem should reduce to finding the minimum singular value/vector and needs to be processed differently.

Could be very useful, but the code doesn't seem to handle (or even give a warning in) certain degenerate cases. For example, in the following, not even a feasible solution is returned

>> spherelsq([1 -1; 1 -1],[0;0],sqrt(2))

ans =

0
0

Also, why not include a routine in the package that deals with the more general quadratic objective,

min. x'*H*x-g'*x
s.t. |x|=xnorm

since you convert to this form anyway, and the theory seems to accommodate it?