Description
I figured something like this could be useful (although not strictly necessary) pre-requisite for #3149
Consider rectangular matrices
The left-hand-side expression is elegant and concise way to write it. From programmers perspective, it's convenient especially when we already have matrices on input.
The middle expression seems like a good way to compute the value in a vectorized way. It's asymptotically faster than computing the whole product and then taking the trace.
The right-hand-side expression is just expanded form and may appear in the wild. It suggests computing it as sum of elementwise product of
I thus suggest we add a function like real trace_dot(matrix a, matrix b)
. Note that we already have functions like trace_quad_form
that do something related.
Not sure if the property
For autodiff, I think there is