diff --git a/doc/development/deprecations.rst b/doc/development/deprecations.rst
index c91979963a9..22b478ab3a5 100644
--- a/doc/development/deprecations.rst
+++ b/doc/development/deprecations.rst
@@ -39,6 +39,12 @@ Pending deprecations
- Deprecated in v0.37
- Will be removed in v0.39
+* The ``QubitStateVector`` template is deprecated.
+ Instead, use ``StatePrep``.
+
+ - Deprecated in v0.39
+ - Will be removed in v0.40
+
New operator arithmetic deprecations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md
index 91194ac1e19..3f3a3c04326 100644
--- a/doc/releases/changelog-dev.md
+++ b/doc/releases/changelog-dev.md
@@ -90,6 +90,10 @@
Deprecations 👋
+* The ``QubitStateVector`` template is deprecated.
+ Instead, use ``StatePrep``.
+ [(#6172)](https://github.com/PennyLaneAI/pennylane/pull/6172)
+
* `Device`, `QubitDevice`, and `QutritDevice` will no longer be accessible via top-level import in v0.40.
They will still be accessible as `qml.devices.LegacyDevice`, `qml.devices.QubitDevice`, and `qml.devices.QutritDevice`
respectively.
diff --git a/pennylane/ops/qubit/state_preparation.py b/pennylane/ops/qubit/state_preparation.py
index 7ef84be70fd..6bfb4179e00 100644
--- a/pennylane/ops/qubit/state_preparation.py
+++ b/pennylane/ops/qubit/state_preparation.py
@@ -15,6 +15,8 @@
This submodule contains the discrete-variable quantum operations concerned
with preparing a certain state on the device.
"""
+import warnings
+
# pylint:disable=too-many-branches,abstract-method,arguments-differ,protected-access,no-member
from typing import Optional
@@ -442,9 +444,19 @@ def _preprocess(state, wires, pad_with, normalize, validate_norm):
return state
-# pylint: disable=missing-class-docstring
class QubitStateVector(StatePrep):
- pass # QSV is still available
+ r"""
+ ``QubitStateVector`` is deprecated and will be removed in version 0.40. Instead, please use ``StatePrep``.
+ """
+
+ # pylint: disable=too-many-arguments
+ def __init__(self, state, wires, pad_with=None, normalize=False, validate_norm=True):
+ warnings.warn(
+ "QubitStateVector is deprecated and will be removed in version 0.40. "
+ "Instead, please use StatePrep.",
+ qml.PennyLaneDeprecationWarning,
+ )
+ super().__init__(state, wires, pad_with, normalize, validate_norm)
class QubitDensityMatrix(Operation):
diff --git a/tests/drawer/test_drawable_layers.py b/tests/drawer/test_drawable_layers.py
index 7e1bdb1d0bd..729e0f74609 100644
--- a/tests/drawer/test_drawable_layers.py
+++ b/tests/drawer/test_drawable_layers.py
@@ -196,7 +196,7 @@ def test_mid_measure_custom_wires(self):
m1 = qml.measurements.MeasurementValue([mp1], lambda v: v)
def teleport(state):
- qml.QubitStateVector(state, wires=["A"])
+ qml.StatePrep(state, wires=["A"])
qml.Hadamard(wires="a")
qml.CNOT(wires=["a", "B"])
qml.CNOT(wires=["A", "a"])
diff --git a/tests/ops/functions/conftest.py b/tests/ops/functions/conftest.py
index 92863eb7ab1..692745b48b6 100644
--- a/tests/ops/functions/conftest.py
+++ b/tests/ops/functions/conftest.py
@@ -38,7 +38,6 @@
qml.sum(qml.X(0), qml.X(0), qml.Z(0), qml.Z(0)),
qml.BasisState([1], wires=[0]),
qml.ControlledQubitUnitary(np.eye(2), control_wires=1, wires=0),
- qml.QubitStateVector([0, 1], wires=0),
qml.QubitChannel([np.array([[1, 0], [0, 0.8]]), np.array([[0, 0.6], [0, 0]])], wires=0),
qml.MultiControlledX(wires=[0, 1]),
qml.Projector([1], 0), # the state-vector version is already tested
@@ -137,6 +136,7 @@
PowOpObs,
PowOperation,
PowObs,
+ qml.QubitStateVector,
}
"""Types that should not have actual instances created."""
diff --git a/tests/ops/qubit/test_state_prep.py b/tests/ops/qubit/test_state_prep.py
index 342aaff5df0..e6da832a8eb 100644
--- a/tests/ops/qubit/test_state_prep.py
+++ b/tests/ops/qubit/test_state_prep.py
@@ -36,6 +36,12 @@ def test_adjoint_error_exception(op):
op.adjoint()
+def test_QubitStateVector_is_deprecated():
+ """Test that QubitStateVector is deprecated."""
+ with pytest.warns(qml.PennyLaneDeprecationWarning, match="QubitStateVector is deprecated"):
+ _ = qml.QubitStateVector([1, 0, 0, 0], wires=[0, 1])
+
+
@pytest.mark.parametrize(
"op, mat, base",
[