You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I figured something like this could be useful (although not strictly necessary) pre-requisite for #3149
Consider rectangular matrices . We can observe the following:
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 and which is maybe better computationally, but kinda obscures the linear-algebraic structure.
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 can be useful here, but it allows us to choose (in the middle formula) to do either more dot products of shorter vectors or fewer dot-products of longer vectors. It should amount to the same number of multiplications but perhaps for hardware acceleration one of those is preferred.
For autodiff, I think there is
The text was updated successfully, but these errors were encountered:
I figured something like this could be useful (although not strictly necessary) pre-requisite for #3149
Consider rectangular matrices . We can observe the following:
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 and which is maybe better computationally, but kinda obscures the linear-algebraic structure.
I thus suggest we add a function like
real trace_dot(matrix a, matrix b)
. Note that we already have functions liketrace_quad_form
that do something related.Not sure if the property can be useful here, but it allows us to choose (in the middle formula) to do either more dot products of shorter vectors or fewer dot-products of longer vectors. It should amount to the same number of multiplications but perhaps for hardware acceleration one of those is preferred.
For autodiff, I think there is
The text was updated successfully, but these errors were encountered: