amc.reduction module¶
Functions for the AMC reduction of equations.
-
amc.reduction.
reduce_equation
(equation, *, permute=None, collect_ninejs=False, convention='wigner', monitor=lambda t, nt, p, np: None, verbose=False)¶ Reduce the given equation to angular-momentum coupled form.
- Parameters
- equationast.Equation
Equation to reduce.
- permute{False, True, ‘smart’}
Warning
Not yet implemented.
Permute tensor subscripts in order to get a simpler coupled expression. If set to ‘smart’, only try permutations most likely to succeed.
- collect_ninejsbool
Try to construct 9j-symbols from sums over products of 6j-symbols.
- convention{‘wigner’, ‘sakurai’}
Use the given convention for Wigner-Eckart reduced matrix elements.
- monitor: callable(term: `int`, nterms: `int`, perm: `int`, nperms: `int`)
Called once for each permutation processed. term and perm are zero-based.
- verbose: `bool`
Output additional information during the reduction process.
- Returns
- amc.ast.Equation
The angular-momentum reduced equation.
- Raises
- amc.error.ReductionError
If one of the terms cannot be fully reduced.
-
amc.reduction.
reduce_term
(lhs, aux_lhs_ast, term, index_number, zero_ast, *, permute=None, collect_ninejs=False, convention='wigner', monitor=lambda p, np: None)¶ Reduce a single term into angular-momentum coupled form.
- Parameters
- lhsast.Variable
Left-hand side of the equation.
- aux_lhs_ast: `list` of `ast.Index`
Auxiliary indices of the reduced left-hand side tensor.
- termast.Mul or ast.Sum
Term to reduce. Should be a single sum over a product of tensor variables.
- index_numberdict {‘hint’: int, ‘int’: int, ‘rank’: int}
Dictionary holding the counters for automatically generating auxiliary indices. Values should be large enough so that new generated names do not alias left-hand auxiliary indices.
- zero_astast.Index
Index denoting a zero angular momentum.
- permute{False, True, ‘smart’}
Warning
Not yet implemented.
Permute tensor subscripts in order to get a simpler coupled expression. If set to ‘smart’, only try permutations most likely to succeed.
- collect_ninejsbool
Try to construct 9j-symbols from sums over products of 6j-symbols.
- convention{‘wigner’, ‘sakurai’}
Use the given convention for Wigner-Eckart reduced matrix elements.
- monitor: callable(permint, nperms
Called once for each permutation processed. perm is zero-based.
- verbose: `bool`
Output additional information during the reduction process.
- Returns
- ast.Sum or ast.Mul
The angular-momentum reduced term.
- Raises
- amc.error.GraphNotReducibleError
If the Yutsis graph cannot be fully reduced.
- amc.error.GraphNotOrientableError
If the Yutsis graph cannot be oriented.
-
amc.reduction.
variable_to_clebsches
(v, idx, convention='wigner', lhs=False)¶ Generate a Clebsch-Gordan network according to the coupling scheme of the given tensor variable.
- Parameters
- vast.Variable
The tensor variable.
- idxdict`(`ast.Index: yutsis.Idx)
Mapping from AST indices to Yutsis graph indices
- convention{‘wigner’, ‘sakurai’}
Use the given convention for Wigner-Eckart reduced matrix elements.
- lhsbool
Set to True to generate the Clebsch-Gordan network for the variable on the left-hand side to reduce the right-hand side of the equation. Depending on convention and wet_scalar, this needs some additional hat factors to cancel a free summation over the total projection quantum number. This factor is added when lhs is True.
- Returns
- clebscheslist of yutsis.ClebschGordan
List of Clebsch-Gordan coefficients needed to (un-)reduce the variable
- auxlist of yutsis.Idx
List of additional angular-momentum indices generated in the reduction process.
-
amc.reduction.
handle_deltas
(Y)¶ Handle delta constraints arising from the reduction of the Yutsis graph.
Separates all indices mentioned in delta constraints of the Yutsis graph Y into disjoint sets, where all indices are constrained by deltas to have the same value. Selects one index from each of these sets as independent, and marks all others as dependent, transferring phases and hat factor powers to the independent index.
- Parameters
- Yyutsis.Graph
Yutsis graph to process.
- Returns
- dict`(`yutsis.Idx: yutsis.Idx)
mapping from all encountered indices to their independent index.
-
amc.reduction.
generate_auxiliary_ast_indices
(v, index_number, zero)¶ Generate auxiliary AST indices arising from the reduction of the given variable.
- Parameters
- vast.Variable
Tensor variable.
- index_numberdict {‘hint’: int, ‘int’: int, ‘rank’: int}
Dictionary holding the counters for automatically generating auxiliary indices. Values should be large enough so that new generated names do not alias already existing ones.
- zeroast.Index
AST index to use for zero indices.
- Returns
- list of ast.Index
List of generated indices.
-
amc.reduction.
yutsis_auxiliary_indices_to_ast
(aux_idx, subscript_map, index_number, zero)¶ Generate AST indices for unconstrained Yutsis indices.
Generates new AST indices for the given list of Yutsis indices, and adds them to
subscript_map
.- Parameters
- aux_idxlist of yutsis.Idx
List of Yutsis indices to process.
- subscript_mapdict`(`yutsis.Idx: amc.ast.Index)
Mapping from Yutsis indices to known AST indices, e.g., external indices. New indices are added to this mapping.
- index_numberdict {‘hint’: int, ‘int’: int, ‘rank’: int}
Dictionary holding the counters for automatically generating auxiliary indices. Values should be large enough so that new generated names do not alias already existing ones.
- zeroast.Index
AST index to use for zero indices.