norm

tenpy.linalg.np_conserved.norm(a, ord=None, convert_to_float=True)[source]

Norm of flattened data.

Equivalent to np.linalg.norm(a.to_ndarray().flatten(), ord).

In contrast to numpy, we don’t distinguish between matrices and vectors, but simply calculate the norm for the flat (block) data. The usual ord-norm is defined as \((\sum_i |a_i|^{ord} )^{1/ord}\).

ord

norm

None/’fro’

Frobenius norm (same as 2-norm)

np.inf

max(abs(x))

-np.inf

min(abs(x))

0

sum(a != 0) == np.count_nonzero(x)

other

usual ord-norm

Parameters:
  • a (Array | np.ndarray) – The array of which the norm should be calculated.

  • ord – The order of the norm. See table above.

  • convert_to_float – Convert integer to float before calculating the norm, avoiding int overflow.

Returns:

norm – The norm over the flat data of the array.

Return type:

float