]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
(fixes #5681) Vector*matrix not implemented
authorjussi.koskela <jussi.koskela@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 24 Feb 2015 13:35:10 +0000 (13:35 +0000)
committerjussi.koskela <jussi.koskela@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 24 Feb 2015 13:35:10 +0000 (13:35 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30972 ac1ea38d-2e2b-0410-8846-a27921b304fc

fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Array.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Multiplication.java

index cb16d4b9f8b64cc28baeec70c4830fd67392e402..3f9693c0ef9a84505a8ee5bb2323cd315ee74ee1 100644 (file)
@@ -327,6 +327,20 @@ public class Array implements IExpression {
                return result;\r
        }\r
 \r
+       /*\r
+        * Other array is matrix (this is vector)\r
+        */\r
+       public Array vectorMulMatrix(Array other) {\r
+               Array result = new Array();\r
+               Array transposed = other.transposed();\r
+               for(Object o : transposed.elements) {\r
+                       // Objects are columns\r
+                       Array a = (Array)o;\r
+                       result.addElement(this.inner(a));\r
+               }\r
+               return result;\r
+       }\r
+       \r
        /*\r
         * Other array is vector (this is matrix)\r
         */\r
index 97791824bc142a658d0136f550db7dcd0b19317a..ad6f3f074c8b8cb601784f3b82593b8c4b2ca08e 100644 (file)
@@ -40,6 +40,8 @@ public class Multiplication implements IExpression {
                        Array ra = (Array)right;\r
                        if(la.isVector && ra.isVector) {\r
                                return la.inner(ra);\r
+                       } else if(la.isVector) {\r
+                               return la.vectorMulMatrix(ra);\r
                        } else if(ra.isVector) {\r
                                return la.matrixMulVector(ra);\r
                        } else {\r