sf.physics.norm

mrmustard.physics.norm(A)[source]

Calculates the norm of a quantum state.

The norm is equal to the trace of the density matrix if the state is mixed and to the norm of the state vector if the state is pure.

Parameters:

A (State) – the quantum state

Returns:

the norm of the state

Return type:

float