Skip to content

Commit

Permalink
- Added outerProduct as external "builtin"
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10024 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 6, 2011
1 parent c351b69 commit c7c8a9a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Compiler/FrontEnd/Builtin.mo
Expand Up @@ -514,8 +514,6 @@ algorithm
env = Env.extendFrameT(env, "cardinality", anyNonExpandableConnector2int);
env = Env.extendFrameT(env, "cardinality", anyExpandableConnector2int);
env = Env.extendFrameT(env, "Integer", enumeration2int);
env = Env.extendFrameT(env, "outerproduct", vectorVector2int) "Only real and int makes sense here. And maybe bool." ;
env = Env.extendFrameT(env, "outerproduct", vectorVector2real);
env = Env.extendFrameT(env, "linspace", realRealInt2vectorreal);
env = Env.extendFrameT(env, "noEvent", real2real);
env = Env.extendFrameT(env, "constrain", realrealreal2real);
Expand Down
28 changes: 24 additions & 4 deletions Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -223,6 +223,8 @@ function rem = overload(OpenModelica.Internal.intRem,OpenModelica.Internal.realR

function abs = overload(OpenModelica.Internal.intAbs,OpenModelica.Internal.realAbs);

function outerProduct = overload(OpenModelica.Internal.outerProductInt,OpenModelica.Internal.outerProductReal);

// Dummy functions that can't be properly defined in Modelica, but used by
// SCodeFlatten to define which builtin functions exist (SCodeFlatten doesn't
// care how the functions are defined, only if they exist or not).
Expand Down Expand Up @@ -251,10 +253,6 @@ function transpose
external "builtin";
end transpose;

function outerProduct
external "builtin";
end outerProduct;

function symmetric
external "builtin";
end symmetric;
Expand Down Expand Up @@ -469,6 +467,28 @@ package Internal "Contains internal implementations, e.g. overloaded builtin fun
external "builtin" z=rem(x,y);
end realRem;

function outerProductInt
input Integer[:] v1;
input Integer[:] v2;
output Integer[size(v1,1),size(v2,1)] o;
external "builtin";
/* Not working due to problems with matrix and transpose :(
algorithm
o := matrix(v1) * transpose(matrix(v2));
*/
end outerProductInt;

function outerProductReal
input Real[:] v1;
input Real[:] v2;
output Real[size(v1,1),size(v2,1)] o;
external "builtin";
/* Not working due to problems with matrix and transpose :(
algorithm
o := matrix(v1) * transpose(matrix(v2));
*/
end outerProductReal;

end Internal;

package Scripting
Expand Down

0 comments on commit c7c8a9a

Please sign in to comment.