I am writting a function that should find out first the dimension of space where input vectors are living. The orientation of vectors is unknown, so that it can be 1*ndim or ndim*1. I would like to find a beautiful one liner to do so. I tried this one, but this is not proper syntax:
ndim = [max(n,p) for n,p in (n,p) = np.shape(X) if min(n,p) = 1]
btw, I also want to quickly check whether the little dimension is effectively 1.
Any idea?
I think that the following fixes the errors in your expression:
To quickly check if the smallest dimension is
1, use: