-
Notifications
You must be signed in to change notification settings - Fork 165
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
Complex matrix vector multiplication added in MSL trunk #1890
Comments
Modified by beutlich on 2 Feb 2016 12:48 UTC |
Comment by ahaumer on 3 Feb 2016 14:10 UTC |
Comment by ahaumer on 3 Feb 2016 15:14 UTC |
Comment by ahaumer on 3 Feb 2016 15:46 UTC
|
Comment by ahaumer on 3 Feb 2016 18:32 UTC |
Comment by beutlich on 3 Feb 2016 21:49 UTC My only issue is that this is now the least elegant solution and I wonder why neither the proposed matrixVectorProduct nor your even more elegant matrixVectorProduct (using _ComplexMath.'sum' _) did not work out. |
Comment by beutlich on 4 Feb 2016 09:59 UTC |
Comment by ahaumer on 4 Feb 2016 13:10 UTC
|
Comment by sjoelund.se on 4 Feb 2016 13:21 UTC
Then you also propose not operator overloading since that is the same as function calls.
Function calls did not work in Dymola? This is equivalent to operator overloading in Modelica (the only difference is that the function is manually selected). |
Comment by beutlich on 4 Feb 2016 13:32 UTC |
Modified by dietmarw on 4 Feb 2016 14:41 UTC |
Comment by ahaumer on 5 Feb 2016 14:24 UTC It was desired to find an alternative for the original formulation. This problem seems to be solved (at least for me). Maybe we can implement a more elegant solution in future - but then we sould shift the milestone (for sure not 3.2.2). If you want to have a discussion regarding equations, operator overloading, functions, inlinig, etc. we should open a new ticket. I admit I do not know too much about compiler, but I'd like to know more abput that from a modeler's point of view. |
Comment by ahaumer on 5 Feb 2016 14:33 UTC |
Comment by beutlich on 5 Feb 2016 14:42 UTC |
Comment by hansolsson on 18 Feb 2016 13:00 UTC
I was going to ask about the exact problem - and then I realized it: Even if matrixVectorProduct is a one-line it will not be fully inlined unless
(well, or using v.re if you want shorter code). |
Comment by beutlich on 18 Feb 2016 13:17 UTC |
Comment by hansolsson on 18 Feb 2016 15:55 UTC
I see that as less important and also more complicated - unless you 'cheat' by using the logarithm to compute the product. However, for matrixVectorProduct I would still prefer if we just wrote m*v. |
Comment by beutlich on 18 Feb 2016 16:05 UTC However, m*v requires a tool to first consider the matrix-vector-product and second the overloaded times operator. Is this according to the MLS? Can you please give the reasons why we have function scalarProduct in Complex? |
Comment by otter on 18 Feb 2016 16:19 UTC
Improved implementation of 'sum' so that it can be inlined (and introducing Inline=true annotation) in 7d7f4ee |
Comment by hansolsson on 18 Feb 2016 16:20 UTC
Yes. The rules in M Spec 32 R2 in section 14.4 are that vector*vector and vector*matrix are undefined, but matrix*vector and matrix*matrix are defined - using the same definition as in 10.6.4 (and relying on Complex.'0' for zero inner size).
Because (Note: Wikipedia gives a definition that conjugates 'b' for scalar product, but the bra-ket notation conjugates 'a'.) E.g. Matlab solves it by writing a*b' - where ' is the conjugate transpose. |
Comment by hansolsson on 18 Feb 2016 16:23 UTC
Because matrixVectorProduct uses ComplexMath.'sum', and we needed to inline both functions to get to the scalar level. |
Comment by otter on 18 Feb 2016 16:49 UTC
|
Comment by beutlich on 18 Feb 2016 20:49 UTC |
Comment by otter on 26 Feb 2016 01:05 UTC |
Comment by beutlich on 26 Feb 2016 07:32 UTC |
Comment by beutlich on 29 Feb 2016 22:14 UTC |
Comment by otter on 1 Mar 2016 07:23 UTC
I totally disagree. We have a solution now that works in several tools. The only good alternative is that all tools support Modelica 3.2 fully. It is not worth to force tools to support now overloaded matrix operations on operator records (which is the only fully "clean" solution). Fill a new ticket, if you think this should be fixed in the future and we change the implementation in a future release once better tool support is available. |
git-svn-id: https://svn.modelica.org/projects/Modelica/trunk@9033 7ce873d0-865f-4ce7-a662-4bb36ea78beb
…delica#1890 git-svn-id: https://svn.modelica.org/projects/Modelica/trunk@9034 7ce873d0-865f-4ce7-a662-4bb36ea78beb
git-svn-id: https://svn.modelica.org/projects/Modelica/trunk@9035 7ce873d0-865f-4ce7-a662-4bb36ea78beb
…added in MSL trunk) As suggested, implemented 'sum' so that it can be inlined (and introduced Inline=true annotation) git-svn-id: https://svn.modelica.org/projects/Modelica/trunk@9050 7ce873d0-865f-4ce7-a662-4bb36ea78beb
…added in MSL trunk) As suggested, introduced function MatrixVectorProduct and used it. This works in Dymola. git-svn-id: https://svn.modelica.org/projects/Modelica/trunk@9051 7ce873d0-865f-4ce7-a662-4bb36ea78beb
…added in MSL trunk) Reverted changes from r9051, so the matrix-vector product function is removed and the matrix-vector product of complex arrays is replaced by the previoius array comprehension implementation. The reason is that r9051 did not work in OpenModelica. The reverted change has been tested to work in Dymola and in OpenModelica. git-svn-id: https://svn.modelica.org/projects/Modelica/trunk@9073 7ce873d0-865f-4ce7-a662-4bb36ea78beb
Reported by beutlich on 25 Jan 2016 09:04 UTC
The newly introduced matrix vector product of type Complex (e.g., in Modelica.Magnetic.QuasiStatic.FundamentalWave.Components.MultiPhaseElectroMagneticConverter.vSymmetricalComponent) is currently not supported by all tools.
We therefore propose to add a new function matrixVectorProduct to Modelica.ComplexMath in order to circumvent this problem.
The following test model contains three implementations of the complex matrix vector product.
Migrated-From: https://trac.modelica.org/Modelica/ticket/1890
The text was updated successfully, but these errors were encountered: