BlockEncoding
Describes a block encoding of a matrix A. A unitary U is an (alpha, block_size, epsilon)-block-encoding of A if: A = alpha * (<0|^block_size (x) I) U (|0>^block_size (x) I)
Methods:
Attributes:
from_unitary
from_unitary(
cls: ,
unitary: QCallable,
block_size: int,
alpha: float,
data_size: int,
hermitian_be: bool = False
) -> BlockEncoding
Parameters:
from_dense_diagonals
from_dense_diagonals(
cls: ,
diagonals: Sequence[tuple[Sequence[float], int]],
hermitian_be: bool | None = None
) -> BlockEncoding
Block encoding of a matrix given by dense diagonals, via amplitude loading + LCU.
Parameters:
from_constant_diags
from_constant_diags(
cls: ,
diagonals: Sequence[tuple[float, int]],
cyclic: bool = False,
size: int,
hermitian_be: bool | None = None
) -> BlockEncoding
Block encoding of a matrix given by constant diagonals, via LCU.
Parameters:
from_sparse_pauli_op
from_sparse_pauli_op(
cls: ,
pauli_op: SparsePauliOp,
graycode: bool = False,
hermitian_be: bool | None = None
) -> BlockEncoding
Block encoding of a Hamiltonian, given as a sparse Pauli operator, via LCU.
Parameters:
from_matrix
from_matrix(
cls: ,
mat: np.ndarray,
hermitian_be: bool | None = None
) -> BlockEncoding
Block encoding of an arbitrary matrix via Pauli decomposition and LCU.
Parameters:
from_sparse_oracles
from_sparse_oracles(
cls: ,
oracle_amplitude: QCallable,
oracle_column: QCallable,
sparsity: int,
data_size: int,
hermitian_be: bool = False
) -> BlockEncoding
Block encoding of an s-sparse matrix via sparsity + amplitude oracles.
Parameters:
weighted_sum
weighted_sum(
cls: ,
coefficients: Sequence[complex],
bes: Sequence[BlockEncoding],
hermitian_be: bool | None = None
) -> BlockEncoding
Block encoding of sum_j coefficients[j] * A_j via a single LCU.
A nonzero phase on a coefficient is realized by lcu’s phase table
(prepare_select/assign_phase_table) as a genuine relative phase between
the LCU branches.
Scaling factor: sum_j |coefficients[j] * alpha_j|.
Block size: max_j(block_size_j) + max(ceil(log2(len(bes))), 1) (LCU select register).
Error: 0 (exact encoding, given exact inputs).
Parameters:
product
product(
cls: ,
bes: list[BlockEncoding],
hermitian_be: bool | None = None
) -> BlockEncoding
Block encoding of a product with logarithmic flag overhead.
Parameters:
tensor_product
tensor_product(
cls: ,
be1: BlockEncoding,
be2: BlockEncoding,
hermitian_be: bool | None = None
) -> BlockEncoding
Block encoding of A1 (x) A2 of two block encodings acting on disjoint
data subsystems. See _block_encoding_tensor_product for the qubit
ordering convention.
Parameters:
inverse
inverse(
self: ,
kappa: float,
degree: int | None = None,
eps: float | None = None,
hermitian_be: bool | None = None
) -> BlockEncoding
Block encoding of A^ via QSVT polynomial inversion.
Parameters:
qubitize
qubitize(
self:
) -> BlockEncoding
Qubitization walk operator W = R * U (Low-Chuang); powers of W give
Chebyshev polynomials of the encoded matrix via Qmod’s power.
Parameters:
bound_call
bound_call(
self: ,
data: Any,
block: Any
) -> Callable[[], None]
Parameters:
to_matrix
to_matrix(
self:
) -> np.ndarray
Reconstruct the encoded matrix A, up to a global phase, via statevector simulation.
Note: The result is exact up to an overall global phase.
Parameters: