144 |
(* end case *)) |
(* end case *)) |
145 |
| (Op.Dot d, args) => CL.E_Apply(N.dot d, args) |
| (Op.Dot d, args) => CL.E_Apply(N.dot d, args) |
146 |
| (Op.MulVecMat(m, n), args) => |
| (Op.MulVecMat(m, n), args) => |
147 |
if (1 < m) andalso (m < 4) andalso (m = n) |
if (1 < m) andalso (m <= 4) andalso (m = n) |
148 |
then CL.E_Apply(N.mulVecMat(m,n), args) |
then CL.E_Apply(N.mulVecMat(m,n), args) |
149 |
else raise Fail "unsupported vector-matrix multiply" |
else raise Fail "unsupported vector-matrix multiply" |
150 |
| (Op.MulMatVec(m, n), args) => |
| (Op.MulMatVec(m, n), args) => |
151 |
if (1 < m) andalso (m < 4) andalso (m = n) |
if (1 < m) andalso (m <= 4) andalso (m = n) |
152 |
then CL.E_Apply(N.mulMatVec(m,n), args) |
then CL.E_Apply(N.mulMatVec(m,n), args) |
153 |
else raise Fail "unsupported matrix-vector multiply" |
else raise Fail "unsupported matrix-vector multiply" |
154 |
| (Op.MulMatMat(m, n, p), args) => |
| (Op.MulMatMat(m, n, p), args) => |
155 |
if (1 < m) andalso (m < 4) andalso (m = n) andalso (n = p) |
if (1 < m) andalso (m <= 4) andalso (m = n) andalso (n = p) |
156 |
then CL.E_Apply(N.mulMatMat(m,n,p), args) |
then CL.E_Apply(N.mulMatMat(m,n,p), args) |
157 |
else raise Fail "unsupported matrix-matrix multiply" |
else raise Fail "unsupported matrix-matrix multiply" |
158 |
| (Op.Cross, args) => CL.E_Apply(N.cross(), args) |
| (Op.Cross, args) => CL.E_Apply(N.cross(), args) |
159 |
| (Op.Norm(Ty.TensorTy[n]), args) => CL.E_Apply(N.length n, args) |
| (Op.Norm(Ty.TensorTy[n]), args) => CL.E_Apply(N.length n, args) |
160 |
| (Op.Norm(Ty.TensorTy[m,n]), args) => CL.E_Apply(N.norm(m,n), args) |
| (Op.Norm(Ty.TensorTy[m,n]), args) => CL.E_Apply(N.normMat(m,n), args) |
161 |
|
| (Op.Norm(Ty.TensorTy[m,n,p]), args) => CL.E_Apply(N.normTen3(m,n,p), args) |
162 |
| (Op.Normalize d, args) => CL.E_Apply(N.normalize d, args) |
| (Op.Normalize d, args) => CL.E_Apply(N.normalize d, args) |
163 |
| (Op.Scale(Ty.TensorTy[n]), args) => CL.E_Apply(N.scale n, args) |
| (Op.Scale(Ty.TensorTy[n]), args) => CL.E_Apply(N.scale n, args) |
164 |
| (Op.PrincipleEvec ty, _) => raise Fail "PrincipleEvec unimplemented" |
| (Op.PrincipleEvec ty, _) => raise Fail "PrincipleEvec unimplemented" |
347 |
[CL.mkCall(N.scaleMat(m,n), lhs :: trExps(env, args))] |
[CL.mkCall(N.scaleMat(m,n), lhs :: trExps(env, args))] |
348 |
| IL.E_Op(Op.MulMatMat(m,n,p), args) => |
| IL.E_Op(Op.MulMatMat(m,n,p), args) => |
349 |
[CL.mkCall(N.mulMatMat(m,n,p), lhs :: trExps(env, args))] |
[CL.mkCall(N.mulMatMat(m,n,p), lhs :: trExps(env, args))] |
350 |
|
| IL.E_Op(Op.MulVecTen3(m, n, p), args) => |
351 |
|
if (1 < m) andalso (m <= 4) andalso (m = n) andalso (n = p) |
352 |
|
then [CL.mkCall(N.mulVecTen3(m,n,p), lhs :: trExps(env, args))] |
353 |
|
else raise Fail "unsupported vector-tensor multiply" |
354 |
|
| IL.E_Op(Op.MulTen3Vec(m, n, p), args) => |
355 |
|
if (1 < m) andalso (m <= 4) andalso (m = n) andalso (n = p) |
356 |
|
then [CL.mkCall(N.mulTen3Vec(m,n,p), lhs :: trExps(env, args))] |
357 |
|
else raise Fail "unsupported tensor-vector multiply" |
358 |
| IL.E_Op(Op.EigenVals2x2, [m]) => let |
| IL.E_Op(Op.EigenVals2x2, [m]) => let |
359 |
val (m, stms) = expToVar (env, CL.T_Named(N.matTy(2,2)), "m", m) |
val (m, stms) = expToVar (env, CL.T_Named(N.matTy(2,2)), "m", m) |
360 |
in |
in |