Summary
bdsim.codegen has no C++ implementation for Python's @ (matrix multiply) operator -- CppEmitter.expr_BinaryOp's @ case fails loudly at generation time ("matrix multiply (@) has no C++ implementation yet") rather than emitting a call to a matmul() helper that was never actually defined (the previous behavior: silently generated C++ that failed at compile/link time instead of generation time).
This is independent of continuous-time block support (bdsim#93, closed wontfix) -- that issue is specifically about continuous blocks not being pursued at all; this one is about the @ operator itself, which is on the roadmap regardless. @ shows up in sampled/stateless blocks too -- e.g. PROD's matrix branch (prod = prod @ input), reachable today for any PROD block fed matrix inputs.
Proposed fix
Eigen's own Matrix::operator* already performs real matrix multiplication (not elementwise) for two Matrix-typed operands, so a first cut is likely cheap:
// Python: prod @ input ->
(prod * input) // when both operands are Eigen::Matrix-typed
Also needed for PROD's / (matrix division -> np.linalg.inv, which maps to Eigen's .inverse() for square matrices) and, if continuous-block support is ever revisited, LTI_SISO-style self.C @ x.
Scope note
Not the same bug as bdsim#93 -- please don't close this alongside that one; they're unrelated except for sharing a symptom.
Summary
bdsim.codegenhas no C++ implementation for Python's@(matrix multiply) operator --CppEmitter.expr_BinaryOp's@case fails loudly at generation time ("matrix multiply (@) has no C++ implementation yet") rather than emitting a call to amatmul()helper that was never actually defined (the previous behavior: silently generated C++ that failed at compile/link time instead of generation time).This is independent of continuous-time block support (bdsim#93, closed wontfix) -- that issue is specifically about continuous blocks not being pursued at all; this one is about the
@operator itself, which is on the roadmap regardless.@shows up in sampled/stateless blocks too -- e.g.PROD's matrix branch (prod = prod @ input), reachable today for anyPRODblock fed matrix inputs.Proposed fix
Eigen's own
Matrix::operator*already performs real matrix multiplication (not elementwise) for twoMatrix-typed operands, so a first cut is likely cheap:Also needed for
PROD's/(matrix division ->np.linalg.inv, which maps to Eigen's.inverse()for square matrices) and, if continuous-block support is ever revisited,LTI_SISO-styleself.C @ x.Scope note
Not the same bug as bdsim#93 -- please don't close this alongside that one; they're unrelated except for sharing a symptom.