Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 38efbe7

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
[NF] Handle more binary vector operations
Belonging to [master]: - #2352
1 parent 45f753c commit 38efbe7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Compiler/NFFrontEnd/NFOperator.mo

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,10 @@ public
144144
DAE.Type ty;
145145
algorithm
146146
ty := Type.toDAE(op.ty);
147-
148147
daeOp := match op.op
149-
case Op.ADD then DAE.ADD(ty);
150-
case Op.SUB then DAE.SUB(ty);
151-
case Op.MUL then DAE.MUL(ty);
148+
case Op.ADD then if Type.isArray(op.ty) then DAE.ADD_ARR(ty) else DAE.ADD(ty);
149+
case Op.SUB then if Type.isArray(op.ty) then DAE.SUB_ARR(ty) else DAE.SUB(ty);
150+
case Op.MUL then if Type.isArray(op.ty) then DAE.MUL_ARR(ty) else DAE.MUL(ty);
152151
case Op.DIV then DAE.DIV(ty);
153152
case Op.POW then DAE.POW(ty);
154153
case Op.ADD_SCALAR_ARRAY algorithm swapArguments := true; then DAE.ADD_ARRAY_SCALAR(ty);
@@ -157,8 +156,8 @@ public
157156
case Op.SUB_ARRAY_SCALAR algorithm Error.addInternalError(getInstanceName() + ": Don't know how to handle " + String(op.op), sourceInfo()); then DAE.SUB(ty);
158157
case Op.MUL_SCALAR_ARRAY algorithm swapArguments := true; then DAE.MUL_ARRAY_SCALAR(ty);
159158
case Op.MUL_ARRAY_SCALAR then DAE.MUL_ARRAY_SCALAR(ty);
160-
case Op.MUL_VECTOR_MATRIX algorithm Error.addInternalError(getInstanceName() + ": Don't know how to handle " + String(op.op), sourceInfo()); then DAE.MUL(ty);
161-
case Op.MUL_MATRIX_VECTOR algorithm Error.addInternalError(getInstanceName() + ": Don't know how to handle " + String(op.op), sourceInfo()); then DAE.MUL(ty);
159+
case Op.MUL_VECTOR_MATRIX then DAE.MUL_MATRIX_PRODUCT(ty);
160+
case Op.MUL_MATRIX_VECTOR then DAE.MUL_MATRIX_PRODUCT(ty);
162161
case Op.SCALAR_PRODUCT then DAE.MUL_SCALAR_PRODUCT(ty);
163162
case Op.MATRIX_PRODUCT then DAE.MUL_MATRIX_PRODUCT(ty);
164163
case Op.DIV_SCALAR_ARRAY then DAE.DIV_SCALAR_ARRAY(ty);

0 commit comments

Comments
 (0)