New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overloading is unclear about array multiplication. #1469
Comments
Comment by sjoelund.se on 14 May 2014 14:53 UTC |
Comment by stefanv on 14 May 2014 20:31 UTC |
Comment by sjoelund.se on 14 May 2014 21:27 UTC model M
Complex A[4], B[4,5], C[5];
equation
C = A * B;
end M; It will
However, it would be accepted due to point 2 if you had defined a function like this: operator '*'
...
function vecMatMul
import Complex;
input Complex A[:];
input Complex B[:,:]; // We can define any sort of dimensions we like in here. Doesn't have to be [size(A,1),:]
output WhatEver something;
algorithm
...
end vecMatMul;
...
end '*'; |
Comment by hansolsson on 17 Jun 2014 15:25 UTC
This will allow array operations to be overloaded (in rule 2/3). Agreement. |
Comment by hansolsson on 18 Jun 2014 06:53 UTC |
Reported by stefanv on 25 Apr 2014 14:09 UTC
The specification states that vector*vector and vector*matrix should be left undefined instead of following the rules of section 10.6.4. Does that mean if I write,
that I should get an error?
If that is the case, the
scalarProduct
function within the'*'
operator in Complex will never be called.My original interpretation after initially skimming chapter 14 was that a Modelica tool should find a matching function within operator
'*'
, so for example, the multiplication above would find the following if it existed:I assume that this interpretation is incorrect?
Migrated-From: https://trac.modelica.org/Modelica/ticket/1469
The text was updated successfully, but these errors were encountered: