示例#1
0
def preprocess_gem(expressions, replace_delta=True, remove_componenttensors=True):
    """Lower GEM nodes that cannot be translated to C directly."""
    if remove_componenttensors:
        expressions = optimise.remove_componenttensors(expressions)
    if replace_delta:
        expressions = optimise.replace_delta(expressions)
    return expressions
示例#2
0
def Integrals(expressions, quadrature_multiindex, argument_multiindices, parameters):
    """Constructs an integral representation for each GEM integrand
    expression.

    :arg expressions: integrand multiplied with quadrature weight;
                      multi-root GEM expression DAG
    :arg quadrature_multiindex: quadrature multiindex (tuple)
    :arg argument_multiindices: tuple of argument multiindices,
                                one multiindex for each argument
    :arg parameters: parameters dictionary

    :returns: list of integral representations
    """
    # Unroll
    max_extent = parameters["unroll_indexsum"]
    if max_extent:
        def predicate(index):
            return index.extent <= max_extent
        expressions = unroll_indexsum(expressions, predicate=predicate)
    # Choose GEM expression as the integral representation
    expressions = [index_sum(e, quadrature_multiindex) for e in expressions]
    expressions = replace_delta(expressions)
    expressions = remove_componenttensors(expressions)
    expressions = replace_division(expressions)
    argument_indices = tuple(itertools.chain(*argument_multiindices))
    return optimise_expressions(expressions, argument_indices)
示例#3
0
def preprocess_gem(expressions,
                   replace_delta=True,
                   remove_componenttensors=True):
    """Lower GEM nodes that cannot be translated to C directly."""
    if remove_componenttensors:
        expressions = optimise.remove_componenttensors(expressions)
    if replace_delta:
        expressions = optimise.replace_delta(expressions)
    return expressions
示例#4
0
def _evaluate_delta(e, self):
    """Lower delta and evaluate."""
    e, = replace_delta((e, ))
    return self(e)
示例#5
0
def _evaluate_delta(e, self):
    """Lower delta and evaluate."""
    e, = replace_delta((e,))
    return self(e)