[Numpy-discussion] [RFC] should we argue for a matrix power operator, @@?
Andrew Jaffe
a.h.jaffe at gmail.com
Wed Mar 19 09:56:36 EDT 2014
On 16/03/2014 01:31, josef.pktd at gmail.com wrote:
>
>
>
> On Sat, Mar 15, 2014 at 8:47 PM, Warren Weckesser
> <warren.weckesser at gmail.com <mailto:warren.weckesser at gmail.com>> wrote:
>
>
> On Sat, Mar 15, 2014 at 8:38 PM, <josef.pktd at gmail.com
> <mailto:josef.pktd at gmail.com>> wrote:
>
> I think I wouldn't use anything like @@ often enough to remember
> it's meaning. I'd rather see english names for anything that is
> not **very** common.
>
> I find A@@-1 pretty ugly compared to inv(A)
> A@@(-0.5) might be nice (do we have matrix_sqrt ?)
>
>
>
> scipy.linalg.sqrtm:
> http://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.sqrtm.html
>
>
> maybe a good example: I could never figured that one out
>
> M = sqrtm(A)
>
> A = M @ M
>
> but what we use in stats is
>
> A = R.T @ R
> (eigenvectors dot diag(sqrt of eigenvalues)
>
> which sqrt is A@@(0.5) ?
>
> Josef
Agreed- In general, "the matrix square root" isn't a well-defined
quantity. For some uses, the Cholesky decomposition is what you want,
for some others it's the matrix with the same eigenvectors, but the
square root of the eigenvalues, etc. etc.
As an important aside, it would be good if the docs addressed this.
Yours,
Andrew
More information about the NumPy-Discussion
mailing list