class_docstr: Tests for state vector projector observable.
class_docstr_tok: ["Tests","for","state","vector","projector","observable","."]
docstr: Tests that the eigvals property of the StateVectorProjector class returns the correct results.
docstr_tok: ["Tests","that","the","eigvals","property","of","the","StateVectorProjector","class","returns","the","correct","results","."]
code: def test_sv_projector_eigvals(self, state_vector, tol):
      """Tests that the eigvals property of the StateVectorProjector class returns the correct results."""
      num_wires = np.log2(len(state_vector)).astype(int)
      eigvals = qml.Projector(
          state_vector, wires=range(num_wires)
      ).eigvals()
  
      observable = np.outer(state_vector, state_vector.conj())
      expected_eigvals, _ = np.linalg.eig(observable)
  
      assert np.allclose(
          np.sort(eigvals), np.sort(expected_eigvals), atol=tol, rtol=0
      )
  
imports: import functools
  import pickle
  import pytest
  import numpy
  from gate_data import I, X, Y, Z, H
  import pennylane
  from pennylane.ops.qubit.observables import BasisStateProjector, StateVectorProjector
label_desc: Use image node_id 1 for calling the TestStateVectorProjector obj's underlying member method code with example usage: obj.test_sv_projector_eigvals(state_vector, tol) without return types