[racket] Computing dot product via racket math library

From: Neil Toronto (neil.toronto at gmail.com)
Date: Thu Oct 24 11:53:49 EDT 2013

On 10/24/2013 09:30 AM, Dmitry Cherkassov wrote:
> Hi.
> On Thu, Oct 24, 2013 at 7:16 PM, Tobias Hammer <tobias.hammer at dlr.de> wrote:
>> matrix-dot is what you want.
>> Tobias
> OK, it indeed works.
> Hence, there is an error in docs
> http://docs.racket-lang.org/math/matrix_inner.html?q=matrix-dot&q=normalize#%28def._%28%28lib._math%2Fmatrix..rkt%29._matrix-dot%29%29
> Specifically, there is said:
>> In other words the sum of (* a (conjugate b)) is computed where a runs over the entries in M and b runs over the corresponding entries in N.
> and `conjugate' link leads to complex conjugate function, whereas
> there should be `transpose' function.

The Frobenius inner product is often defined as the trace of A*B^T, 
where "^T" means conjugate transpose for complex matrices. Most of the 
entries in A*B^T are thrown away by computing the trace. Computing the 
trace ends up equivalent to multiplying A elementwise by B's elementwise 
conjugation, so the docs are correct.

I think I can make the `matrix-dot' docs communicate better, though, 
especially to people who are looking for vector operations. I'm open to 
suggestions to improve them generally.

Neil ⊥

Posted on the users mailing list.