Loading [MathJax]/jax/output/HTML-CSS/jax.js

qml.math.frobenius_inner_product

frobenius_inner_product(A, B, normalize=False, like=None)[source]

Frobenius inner product between two matrices.

A,BF=ni,j=1AijBij=tr(ATB)

The Frobenius inner product is equivalent to the Hilbert-Schmidt inner product for matrices with real-valued entries.

Parameters
  • A (tensor_like[float]) – First matrix, assumed to be a square array.

  • B (tensor_like[float]) – Second matrix, assumed to be a square array.

  • normalize (bool) – If True, divide the inner product by the Frobenius norms of A and B.

Returns

Frobenius inner product of A and B

Return type

float

Example

>>> A = np.random.random((3,3))
>>> B = np.random.random((3,3))
>>> qml.math.frobenius_inner_product(A, B)
3.091948202943376

Contents

Using PennyLane

Release news

Development

API

Internals