Skip to content

Matrix should be compileable #425

Closed
Closed

Description

@WhiteBlackGoose

The package I want to suggest the idea to: AngouriMath

For now, not as an output type. For example, [0, 1]T * [[a, b], [c, d]] * [1, 0] is fine (because it results in a scalar), but [[a, b], [c, d]] * [1, 0] is not

Activity

  1. added this to the Future milestone on May 20, 2021
  2. Rafael-SOWNet commented on Aug 5, 2026

    @Rafael-SOWNet
    Member

    Re-measured on master (7f83a82). The example in the report compiles:

    var f = "[0, 1]T * [[a, b], [c, d]] * [1, 0]".ToEntity()
        .Compile<double, double, double, double, double>("a", "b", "c", "d");
    f(1, 2, 3, 4);   // 3, which is c

    What was wrong. As you say, it is a scalar -- but nothing simplified the expression before compiling it, so the compiler walked into the matrix node and threw. It is simplified first now, which collapses the product to c before compilation ever sees a matrix.

    What is deliberately still refused, which is the "not as an output type" in your report: an expression whose value is a matrix. [[a, b], [c, d]] * [1, 0], [a, b] and a bare matrix each raise UncompilableNodeException with "Matrix" in the message, rather than failing obscurely. That is #526, which stays open for it.

    Tests in MatrixCompilationTest.cs covering both directions -- the scalar cases compiling and the matrix-valued ones refusing by name -- so the boundary stays where the report puts it. Full suite green.

  3. modified the milestones: Future, 2.6.0 on Sep 30, 2026
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

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions