qlinks.backends package#
Submodules#
qlinks.backends.sparse module#
- class qlinks.backends.sparse.SparseBackend(*args, **kwargs)[source]#
Bases:
ProtocolMinimal backend protocol for sparse Hamiltonian construction.
- name: str#
- as_data_array(data, dtype)[source]#
- Parameters:
data (list[complex])
dtype (DTypeLike)
- Return type:
Any
- coo_matrix(data, rows, cols, shape, dtype)[source]#
- Parameters:
data (Any)
rows (Any)
cols (Any)
shape (tuple[int, int])
dtype (DTypeLike)
- Return type:
Any
- empty_csr(shape, dtype)[source]#
- Parameters:
shape (tuple[int, int])
dtype (DTypeLike)
- Return type:
Any
- __init__(*args, **kwargs)#
- class qlinks.backends.sparse.ScipySparseBackend(name: 'str' = 'scipy')[source]#
Bases:
object- Parameters:
name (str)
- name: str#
- __init__(name='scipy')#
- Parameters:
name (str)
- Return type:
None
- class qlinks.backends.sparse.CupySparseBackend(name='cupy')[source]#
Bases:
objectCuPy/CuPyX sparse backend.
Imported lazily so qlinks does not require CuPy unless backend=”cupy” is used.
Note
cupyx.scipy.sparse currently follows the scipy sparse matrix-style API more closely than scipy’s newer sparse array API. Therefore this backend creates cupyx.scipy.sparse.coo_matrix/csr_matrix, not csr_array.
- Parameters:
name (str)
- name: str#
- property cp#
- property cupyx_sparse#
- coo_matrix(data, rows, cols, shape, dtype)[source]#
- Parameters:
data (Any)
rows (Any)
cols (Any)
shape (tuple[int, int])
dtype (DTypeLike)
- __init__(name='cupy')#
- Parameters:
name (str)
- Return type:
None
- qlinks.backends.sparse.get_sparse_backend(backend='scipy')[source]#
Resolve a sparse backend.
backend=”auto” currently chooses scipy. This keeps behavior deterministic. Later, you can change “auto” to use cupy if an input basis lives on GPU.
- Parameters:
backend (Literal['scipy', 'cupy', 'auto'] | ~qlinks.backends.sparse.SparseBackend)
- Return type:
Module contents#
- class qlinks.backends.CupySparseBackend(name='cupy')[source]#
Bases:
objectCuPy/CuPyX sparse backend.
Imported lazily so qlinks does not require CuPy unless backend=”cupy” is used.
Note
cupyx.scipy.sparse currently follows the scipy sparse matrix-style API more closely than scipy’s newer sparse array API. Therefore this backend creates cupyx.scipy.sparse.coo_matrix/csr_matrix, not csr_array.
- Parameters:
name (str)
- name: str#
- property cp#
- property cupyx_sparse#
- coo_matrix(data, rows, cols, shape, dtype)[source]#
- Parameters:
data (Any)
rows (Any)
cols (Any)
shape (tuple[int, int])
dtype (DTypeLike)
- __init__(name='cupy')#
- Parameters:
name (str)
- Return type:
None
- class qlinks.backends.ScipySparseBackend(name: 'str' = 'scipy')[source]#
Bases:
object- Parameters:
name (str)
- name: str#
- __init__(name='scipy')#
- Parameters:
name (str)
- Return type:
None
- class qlinks.backends.SparseBackend(*args, **kwargs)[source]#
Bases:
ProtocolMinimal backend protocol for sparse Hamiltonian construction.
- name: str#
- as_data_array(data, dtype)[source]#
- Parameters:
data (list[complex])
dtype (DTypeLike)
- Return type:
Any
- coo_matrix(data, rows, cols, shape, dtype)[source]#
- Parameters:
data (Any)
rows (Any)
cols (Any)
shape (tuple[int, int])
dtype (DTypeLike)
- Return type:
Any
- empty_csr(shape, dtype)[source]#
- Parameters:
shape (tuple[int, int])
dtype (DTypeLike)
- Return type:
Any
- __init__(*args, **kwargs)#
- qlinks.backends.get_sparse_backend(backend='scipy')[source]#
Resolve a sparse backend.
backend=”auto” currently chooses scipy. This keeps behavior deterministic. Later, you can change “auto” to use cupy if an input basis lives on GPU.
- Parameters:
backend (Literal['scipy', 'cupy', 'auto'] | ~qlinks.backends.sparse.SparseBackend)
- Return type: