Skip to content

Compiled, a scalar over a matrix argument divides by each entry, where evaluation inverts #2287

Closed

Description

@Rafael-SOWNet

Compiled, a scalar divided by a matrix argument divides by each entry, where evaluation multiplies by the inverse (#2232). Master:

Answered
"2 / [[1, 2], [3, 4]]".ToEntity().Evaled [[-4, 2], [3, -1]], which is 2 times the inverse
"x / A" compiled over GenTensor<double>, with A = [[1, 0], [0, 1]] and x = 1 [[1, Infinity], [Infinity, 1]]

With a matrix written into the expression, compiled output agrees with evaluation, because the expression is simplified before it is compiled: "x / [[1, 0], [2, 4]]" at 1 is [[1, 0], [-0.5, 0.25]]. Only a matrix argument reaches TensorCompilation's DivideFromScalar, which is Elementwise(a, x => Divide(scalar, x)).

Found while testing #2286.

Activity

  1. added this to the 2.7.0 milestone on Oct 30, 2026
  2. moved this from Todo to In Progress in AngouriMathon Oct 30, 2026
  3. moved this from In Progress to Done in AngouriMathon Oct 31, 2026
  4. added a commit that references this issue on Nov 4, 2026
    0f3df21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions