Open antoine-levitt opened 6 years ago
I am not sure what the issue is.
To support them all, of course. From the title of the package I thought it was about more than A*A'
.
No, it is also about A'*A
:wink:
Regarding the use cases:
symprod(A')
and symprod(A)
already takes care of the first two,
something like symsum(A'*B)
can handle A'*B+ B'*A
and similarly A*B'+B*A'
,
symprod(A, B::T)
where T
is some symmetric type could handle A*B*A'
,
A*B+B*A
is not actually symmetric in general.
I use A'A
much more than A*A'
so it would make more sense to me to have symprod(A) = A'A
, but that comes down to personal preferences.
Some alternative names that people sometimes use: overlap/gram/covariance for A'A
, outer for A*A'
. Inner/outer would make a nice symmetric pair, but inner usually refers to tr(A'A) instead.
AFAICT when the outer product is generalized to matrices, the kronecker product is used.
Covariance is already widely used, and using it for something else (although related) would be confusing.
AFAIK the Gram matrix is transpose(A)*A
, which only coincides with A'*A
when A isa AbstractMatrix{<: Real}
.
I also use A'*A
more commonly, but I find that the extra '
makes the semantics cleaner for me.
Good point on outer products for matrices.
Covariance is already widely used, and using it for something else (although related) would be confusing.
Actually I didn't see before, but cov(A)
already does A'A (but doesn't make it symmetric)
AFAIK the Gram matrix is transpose(A)A, which only coincides with A'A when A isa AbstractMatrix{<: Real}.
Usually the Gram matrix is made of inner products and is therefore A'A (see wikipedia)
I like overlap (and actually have overlap(A,B) = Hermitian(A'*B*A)
defined somewhere)
Common cases I can think of:
the last three with symmetric/hermitian B, and the last with symmetric/hermitian A