hdot.m

From Spinach Documentation Wiki
Revision as of 18:49, 5 June 2026 by Kuprov (talk | contribs) (Rename Arguments section heading to Parameters)
Jump to: navigation, search

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