quimb.tensor.contraction¶
Functions relating to tensor network contraction.
Attributes¶
Functions¶
Get the default contraction strategy - the option supplied as |
|
|
Get the default contraction strategy - the option supplied as |
|
A context manager to temporarily set the default contraction strategy |
Get a default dictionary that will populate with symbol entries as they |
|
|
Map a sequence of inputs terms, containing any hashable indices, to |
|
Turn input and output indices of any sort into a single 'equation' |
Get the default backend used for tensor contractions, via 'cotengra'. |
|
|
Set the default backend used for tensor contractions, via 'cotengra'. |
|
A context manager to temporarily set the default backend used for tensor |
Get the default backend used for tensor network linear operators, via |
|
|
Set the default backend used for tensor network linear operators, via |
|
A context manager to temporarily set the default backend used for tensor |
|
|
|
|
|
|
|
|
|
Module Contents¶
- quimb.tensor.contraction._CONTRACT_STRATEGY = 'greedy'¶
- quimb.tensor.contraction._TEMP_CONTRACT_STRATEGIES¶
- quimb.tensor.contraction.get_contract_strategy()[source]¶
Get the default contraction strategy - the option supplied as
optimize
tocotengra
.
- quimb.tensor.contraction.set_contract_strategy(strategy)[source]¶
Get the default contraction strategy - the option supplied as
optimize
tocotengra
.
- quimb.tensor.contraction.contract_strategy(strategy, set_globally=False)[source]¶
A context manager to temporarily set the default contraction strategy supplied as
optimize
tocotengra
. By default, this only sets the contract strategy for the current thread.- Parameters:
set_globally (bool, optimize) – Whether to set the strategy just for this thread, or for all threads. If you are entering the context, then using multithreading, you might want
True
.
- quimb.tensor.contraction.empty_symbol_map()[source]¶
Get a default dictionary that will populate with symbol entries as they are accessed.
- quimb.tensor.contraction.inds_to_symbols(inputs)[source]¶
Map a sequence of inputs terms, containing any hashable indices, to single unicode letters, appropriate for einsum.
- quimb.tensor.contraction.inds_to_eq(inputs, output=None)[source]¶
Turn input and output indices of any sort into a single ‘equation’ string where each index is a single ‘symbol’ (unicode character).
- Parameters:
inputs (sequence of sequence of hashable) – The input indices per tensor.
output (sequence of hashable) – The output indices.
- Returns:
eq – The string to feed to einsum/contract.
- Return type:
- quimb.tensor.contraction._CONTRACT_BACKEND = None¶
- quimb.tensor.contraction._TENSOR_LINOP_BACKEND = None¶
- quimb.tensor.contraction._TEMP_CONTRACT_BACKENDS¶
- quimb.tensor.contraction._TEMP_TENSOR_LINOP_BACKENDS¶
- quimb.tensor.contraction.get_contract_backend()[source]¶
Get the default backend used for tensor contractions, via ‘cotengra’.
See also
set_contract_backend
,get_tensor_linop_backend
,set_tensor_linop_backend
,tensor_contract
- quimb.tensor.contraction.set_contract_backend(backend)[source]¶
Set the default backend used for tensor contractions, via ‘cotengra’.
See also
get_contract_backend
,set_tensor_linop_backend
,get_tensor_linop_backend
,tensor_contract
- quimb.tensor.contraction.contract_backend(backend, set_globally=False)[source]¶
A context manager to temporarily set the default backend used for tensor contractions, via ‘cotengra’. By default, this only sets the contract backend for the current thread.
- Parameters:
set_globally (bool, optimize) – Whether to set the backend just for this thread, or for all threads. If you are entering the context, then using multithreading, you might want
True
.
- quimb.tensor.contraction.get_tensor_linop_backend()[source]¶
Get the default backend used for tensor network linear operators, via ‘cotengra’. This is different from the default contraction backend as the contractions are likely repeatedly called many times.
See also
set_tensor_linop_backend
,set_contract_backend
,get_contract_backend
,TNLinearOperator
- quimb.tensor.contraction.set_tensor_linop_backend(backend)[source]¶
Set the default backend used for tensor network linear operators, via ‘cotengra’. This is different from the default contraction backend as the contractions are likely repeatedly called many times.
See also
get_tensor_linop_backend
,set_contract_backend
,get_contract_backend
,TNLinearOperator
- quimb.tensor.contraction.tensor_linop_backend(backend, set_globally=False)[source]¶
A context manager to temporarily set the default backend used for tensor network linear operators, via ‘cotengra’. By default, this only sets the contract backend for the current thread.
- Parameters:
set_globally (bool, optimize) – Whether to set the backend just for this thread, or for all threads. If you are entering the context, then using multithreading, you might want
True
.