Difference between revisions of "Hdot.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(Create Spinach kernel hdot function page)
(Tag: Removed redirect)
m (Rename Arguments section heading to Parameters)
Line 6: Line 6:
 
     H=hdot(A,B)
 
     H=hdot(A,B)
  
−
==Arguments==
+
==Parameters==
  
 
     A,B - numerical arrays of the same dimensions
 
     A,B - numerical arrays of the same dimensions

Revision as of 18:49, 5 June 2026

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