hdot.m
Hadamard route to Frobenius matrix product. This function computes the Frobenius inner product of two numerical arrays using elementwise multiplication.
Syntax
H=hdot(A,B)
Parameters
A,B - numerical arrays of the same dimensions
Outputs
H - Frobenius inner product of A and B
Notes
For matrices, the function is a faster replacement for `trace(A'*B)` because
trace(A'*B)=sum(conj(A).*B,'all')
and the elementwise route only needs O(n2) multiplications for square n-by-n matrices, compared to O(n3) for matrix multiplication followed by the trace.
See also
Ttclass/hdot.m, cheap_norm.m, krondelta.m, tikhonov.m, Numerical infrastructure
Version 2.11, authors: Ilya Kuprov