qrisp.cks.CKS_parameters#
- CKS_parameters(A, eps, kappa=None, max_beta=None)[source]#
Computes the Chebyshev-series complexity parameter \(\beta\) and the truncation order \(j_0\) for the truncated Chebyshev approximation of \(1/x\) used in the Childs–Kothari–Somma quantum algorithm.
To avoid confusion with the vector \(\ket{b}\), we represent the complexity parameter as \(\beta\).
This function distinguishes two input cases:
- Matrix input
If
Ais either a NumPy array (Hermitian matrix), or a SciPy Compressed Sparse Row matrix (Hermitian matrix), the condition number \(\kappa\) is computed internally as \(\kappa = \mathrm{cond}(A)\) if it is not specified.
- Block-encoding input
If
Ais a 3-tuple representing a block-encoding,kappamust be specified.
Given the condition number \(\kappa\) and the target precision \(\epsilon\), the parameters are computed as:
\[\beta = \kappa^2 \log\!\left(\frac{\kappa}{\epsilon}\right), \quad j_0 = \sqrt{\beta \log\!\left(\frac{4\beta}{\epsilon}\right)}.\]If
max_betais provided, \(\beta\) is capped to \(\min(\beta, \beta_{\max})\). The returned values are cast to integers via the floor operation.- Parameters:
- Anumpy.ndarray or scipy.sparse.csr_matrix or tuple
Either the Hermitian matrix \(A\) of size \(N \times N\) from the linear system \(A \vec{x} = \vec{b}\), or a 3-tuple representing a preconstructed block-encoding.
- epsfloat
Target precision \(\epsilon\), such that the prepared state \(\ket{\tilde{x}}\) is within \(\epsilon\) of \(\ket{x}\).
- kappafloat, optional
Condition number \(\kappa\) of \(A\). Required when
Ais a block-encoding tuple(U, state_prep, n)rather than a matrix.- max_betafloat, optional
Optional upper bound on the complexity parameter \(\beta\).
- Returns:
- j_0int
Truncation order of the Chebyshev expansion \(j_0 = \lfloor\sqrt{\beta \log(4\beta/\epsilon)}\rfloor\).
- betafloat
Complexity parameter \(\beta = \lfloor\kappa^2 \log(\kappa/\epsilon)\rfloor\).