Unique Determinedness
UDA: Unique Determinedness among All density matrices
UDP: Unique Determinedness among Pure quantum states
            numqi.unique_determine.FindStateWithOpModel
    
              Bases: Module
recover quantum states from expectation values of a list of operators
            __init__(op_list, use_dm, dtype='float64')
    initialize the model
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| op_list | ndarray | measurement operator,  | required | 
| use_dm | bool | if  | required | 
| dtype | str | data type of the model, either  | 'float64' | 
            get_state()
    get the recovered state
Returns:
| Name | Type | Description | 
|---|---|---|
| ret | ndarray | recovered state,  | 
            set_expectation(x)
    set the expectation values of the operators
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| x | ndarray | expectation values,  | required | 
            numqi.unique_determine.check_UD_is_UD(op_list, kind='uda', num_round=100, num_repeat_sgd=10, zero_eps=1e-07, seed=None)
    check if the given operators are unique-determine (UD) operators Raise AssertionError if the operators are not UD
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| op_list | ndarray | measurement operator,  | required | 
| kind | str | 
 | 'uda' | 
| num_round | int | number of rounds for the test | 100 | 
| num_repeat_sgd | int | number of SGD repeats for each round | 10 | 
| zero_eps | float | tolerance for the test | 1e-07 | 
| seed | (int, None) | random seed | None | 
            numqi.unique_determine.density_matrix_recovery_SDP(op_list, measure, converge_eps=None)
    recover density matrix from expectation values of a list of operators using SDP
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| op_list | ndarray | measurement operator,  | required | 
| measure | ndarray | expectation values,  | required | 
| converge_eps | (float, None) | convergence tolerance for the SDP solver, if not None, use  | None | 
Returns:
| Name | Type | Description | 
|---|---|---|
| rho | ndarray | recovered density matrix,  | 
| value | float | objective value of the SDP | 
            numqi.unique_determine.get_matrix_list_indexing(mat_list, index)
    get a list of matrices by index. Necessary as both 3d-array and list of sparse matrices are used in this module
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| mat_list | (ndarray, list) | list of matrices | required | 
| index | list[int] | index of the matrices | required | 
Returns:
| Name | Type | Description | 
|---|---|---|
| ret | (ndarray, list) | list of matrices | 
            numqi.unique_determine.get_qutrit_projector_basis(num_qutrit=1)
    get projection basis of qutrit projector (over-complete)
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| num_qutrit | int | number of qutrits | 1 | 
Returns:
| Name | Type | Description | 
|---|---|---|
| ret | ndarray | 
 | 
            numqi.unique_determine.get_chebshev_orthonormal(dim_qudit, alpha, with_computational_basis=False, return_basis=False)
    get Chebyshev polynomials basis (PB)
How many orthonormal bases are needed to distinguish all pure quantum states? doi-link
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| dim_qudit | int | dimension of the qudit | required | 
| alpha | float | phase | required | 
| with_computational_basis | bool | if True, include computational basis (5PB), otherwise 4PB | False | 
| return_basis | bool | if True, also return the basis | False | 
Returns:
| Name | Type | Description | 
|---|---|---|
| ret | ndarray | list of projection operator,  | 
| ret | list[ndarray] | optional, list of length 4 or 5, each element is np.ndarray with  | 
            numqi.unique_determine.save_index_to_file(file, key=None, index=None)
    save index to file and read index from file, mainly used for Pauli UD measurement schemes
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| file | str | file path | required | 
| key | (str, None) | key string, if None, return all saved index | None | 
| index | (None, list[int], list[str], list[list[int]]) | index to be saved, allowed types None: read index from file list[int]: single index,  list[str]: single index,  list[list[int]]: multiple index,  | None | 
Returns:
| Name | Type | Description | 
|---|---|---|
| ret | (dict, list) | the return type depends on (key), if  | 
            numqi.unique_determine.remove_index_from_file(file, key_str, index)
    remove index from file
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| file | str | file path | required | 
| key_str | str | key string | required | 
| index | (list[int], list[str], list[list[int]]) | index to be removed, see  | required | 
            numqi.unique_determine.load_pauli_ud_example(num_qubit=None, tag_group_by_size=False)
    load Pauli UD measurement schemes from built-in data
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| num_qubit | (int, None) | number of qubits | None | 
| tag_group_by_size | bool | if True, return a dict of data grouped by size | False | 
Returns:
| Name | Type | Description | 
|---|---|---|
| ret | (dict, list) | the return type depends on (num_qubit,tag_group_by_size) (None,False): dict[int,list[tuple[int]]] (None,True): dict[int,dict[int,list[tuple[int]]]] (int,False): list[tuple[int]] (int,True): dict[int,list[tuple[int]]] | 
            numqi.unique_determine.get_element_probing_POVM(kind, dim)
    element probing POVM
Strictly-complete measurements for bounded-rank quantum-state tomography doi-link
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| kind | str | 'eq8' or 'eq9' | required | 
| dim | int | dimension of the system | required | 
Returns:
| Name | Type | Description | 
|---|---|---|
| ret | ndarray | 3D array | 
| ret | (dict, list) | the return type depends on (num_qubit,tag_group_by_size) | 
            numqi.unique_determine._uda_udp._UDAEigenvalueManifold
    
              Bases: Module
Eigenvalue manifold for UDA
            __init__(dim, dtype=torch.float32)
    initizalize the model
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| dim | int | dimension of the matrix | required | 
| dtype | dtype | data type of the parameters | float32 | 
            numqi.unique_determine.DetectUDModel
    
              Bases: Module
Model for detecting UDA or UDP
            __init__(dim, is_uda, dtype='float32')
    initizalize the model
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| dim | int | dimension of the matrix | required | 
| is_uda | bool | True for UDA, False for UDP | required | 
| dtype | str | data type of the parameters, 'float32' or 'float64' | 'float32' | 
            set_mat_list(mat_list)
    set the list of Hermitian matrices
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| mat_list | ndarray | list | list of Hermitian matrices, 3d-array or list of sparse matrix assume mat_list is Hermitian | required | 
            numqi.unique_determine.check_UD(kind, mat_list, num_repeat, converge_tol=1e-05, early_stop_threshold=0.01, dtype='float32', num_worker=1, tag_single_thread=True, tag_print=0, return_model=False, seed=None)
    Check if the given measurement scheme (mat_list, matrix subspace) is UDA or UDP
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| kind | str | 'uda' or 'udp' | required | 
| mat_list | ndarray | list | list of Hermitian matrices, 3d-array or list of sparse matrix
assume mat_list is Hermitian. Support batch input, then mat_list is a list of 3d-array or list of sparse matrix.
For batch input, if  | required | 
| num_repeat | int | number of repeat for optimization | required | 
| converge_tol | float | tolerance for convergence | 1e-05 | 
| early_stop_threshold | float | threshold for early stopping | 0.01 | 
| dtype | str | data type of the parameters, 'float32' or 'float64' | 'float32' | 
| num_worker | int | number of workers | 1 | 
| tag_single_thread | bool | if True, use single thread for each worker | True | 
| tag_print | int | 0 for no print, 1 for print only the final result, 2 for print every round | 0 | 
| return_model | bool | if True, return the model | False | 
| seed | int | random seed | None | 
Returns:
| Name | Type | Description | 
|---|---|---|
| tag | bool | True if the measurement scheme is UD. For batch input, it is a list of (tag, loss, model) | 
| loss | float | loss value | 
| parameter | ndarray | parameter of the model | 
            numqi.unique_determine.find_optimal_UD(kind, num_round, mat_list, num_repeat, num_init_sample=0, indexF=None, early_stop_threshold=0.01, converge_tol=1e-05, last_converge_tol=None, last_num_repeat=None, dtype='float32', num_worker=1, key=None, file=None, tag_single_thread=True, tag_print=False, seed=None)
    Find the optimal measurement scheme for UDA or UDP
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| kind | str | 'uda' or 'udp' | required | 
| num_round | int | number of rounds | required | 
| mat_list | ndarray | list | list of Hermitian matrices, 3d-array or list of sparse matrix
assume mat_list is Hermitian.  Support batch input, then mat_list is a list of 3d-array or list of sparse matrix.
For batch input, if  | required | 
| num_repeat | int | number of repeat for optimization | required | 
| num_init_sample | int | number of initial samples | 0 | 
| indexF | None | tuple[int] | index of fixed items | None | 
| early_stop_threshold | float | threshold for early stopping | 0.01 | 
| converge_tol | float | tolerance for convergence | 1e-05 | 
| last_converge_tol | None | float | tolerance for convergence in the last round | None | 
| last_num_repeat | None | int | number of repeat for optimization in the last round | None | 
| dtype | str | data type of the parameters, 'float32' or 'float64' | 'float32' | 
| num_worker | int | number of workers | 1 | 
| key | str | key for saving the result | None | 
| file | str | file for saving the result | None | 
| tag_single_thread | bool | if True, use single thread for each worker | True | 
| tag_print | bool | if True, print the result | False | 
| seed | int | random seed | None | 
Returns:
| Name | Type | Description | 
|---|---|---|
| ret | list[int] | list[list[int]] | list of index of the optimal measurement scheme. For batch input, it is a list of list of index. |