neurolang.frontend.datalog.sugar.spatial module

class neurolang.frontend.datalog.sugar.spatial.DetectEuclideanDistanceBoundMatrix

Bases: PatternWalker

Detect a Euclidean spatial bound in the antecedent of a rule.

This spatial bound is defined by 4 conjuncts in the antecedent of the rule:
  • an equality formula between some variable d and an expression of the form EUCLIDEAN(i1, j1, k1, i2, j2, k2), where EUCLIDEAN is a special reserved symbol for the Euclidean distance function in a 3-dimensional space.

  • a comparison formula between that same variable d and a constant value that sets an upper bound for the distance between points, thereby limiting the set of points that will be considered in the computation.

  • a formula of the form R1(x) where x is a tuple containing i1, j1 and k1 providing a range for (i1, j1, k1) coordinates

  • a formula of the form R2(x) where x is a tuple containing i2, j2 and k2 providing a range for (i2, j2, k2) coordinates

Attributes:
patterns

Property holding an iterator of triplets (pattern, guard, action).

Methods

match(expression)

Find the action for a given expression by going through the patterns.

pattern_match(pattern, expression)

Return True if pattern matches expression.

type

any_other_expression

get_distance_upper_bound

get_range_pred_for_coord

get_var_to_euclidean_equality

implication

pattern_match_expression

pattern_match_expression_parameters

pattern_match_expression_tuple

pattern_match_tuple

walk

any_other_expression(expression)
static get_distance_upper_bound(formulas)
static get_range_pred_for_coord(formulas, coord_args)
static get_var_to_euclidean_equality(formulas)
implication(implication)
type = typing.Any
class neurolang.frontend.datalog.sugar.spatial.TranslateEuclideanDistanceBoundMatrixMixin(*args, **kwargs)

Bases: PatternWalker

Attributes:
patterns

Property holding an iterator of triplets (pattern, guard, action).

Methods

match(expression)

Find the action for a given expression by going through the patterns.

pattern_match(pattern, expression)

Return True if pattern matches expression.

type

euclidean_spatial_bound

pattern_match_expression

pattern_match_expression_parameters

pattern_match_expression_tuple

pattern_match_tuple

safe_range_pred_to_coord_set

solve_spatial_bound

upper_bound_to_max_dist

walk

euclidean_spatial_bound(implication)
safe_range_pred_to_coord_set(range_pred: FunctionApplication, coord_args: Tuple[Symbol]) RelationalAlgebraSet
static solve_spatial_bound(first_coord_array: array, second_coord_array: array, max_dist: float) array
type = typing.Any
static upper_bound_to_max_dist(upper_bound)