From 9f5c58c544b5fa395688be961adbd0118fb861b4 Mon Sep 17 00:00:00 2001 From: Caleb Johnson Date: Thu, 3 Oct 2024 10:09:55 -0500 Subject: [PATCH] Add notes to project_operator docstring --- qiskit_addon_sqd/qubit.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/qiskit_addon_sqd/qubit.py b/qiskit_addon_sqd/qubit.py index 18c65d0..2b14afd 100644 --- a/qiskit_addon_sqd/qubit.py +++ b/qiskit_addon_sqd/qubit.py @@ -104,6 +104,18 @@ def project_operator_to_subspace( The subspace is defined by a collection of computational basis states, which are specified by the bitstrings (rows) in ``bitstring_matrix``. + .. note:: + The bitstrings in the ``bitstring_matrix`` must be unique and sorted in ascending order + according to their unsigned integer representation. Otherwise the projection will return wrong + results. This function does not explicitly check for uniqueness and order because + this can be rather time consuming. See :func:`qiskit_addon_sqd.qubit.sort_and_remove_duplicates` + for a simple way to ensure your bitstring matrix is well-formatted. + + .. note:: + This function relies on ``jax`` to efficiently perform some calculations. ``jax`` + converts the bit arrays to ``int64_t``, which means the bit arrays in + ``bitstring_matrix`` may not have length greater than ``63``. + Args: bitstring_matrix: A 2D array of ``bool`` representations of bit values such that each row represents a single bitstring. This set of