I want to translate my maple code with matrice multiplication to C code. But the command "Multiply" cannot be translated. So I want to edit the function translation by myself. I use "AddFunction" command to create a new function "Multiply" and want to specify its corresponding C code.

*f := proc ()*

*local x,y; *

*x := Matrix([[1, 2], [3, 4]]);*

*y := Matrix([[1,3],[4,2]]); *

*Multiply(x, y); *

*NULL; *

*end proc; *

*LanguageDefinition:-Define("NewC", extend = "C", AddFunction("Multiply", [Matrix,Matrix]::Matrix, *

*proc (X, Y) *

*local a,b; *

*a := 2; *

*b := convert(a, string); *

*Printer:-Print("Mmultiply(", X); *

*Printer:-Print(",", Y, ")"); Printer:-Print("\n"); *

*Printer:-Print("from", b, "to"); *

*Printer:-Print(",", Y, "do") end proc, numeric = double)); *

*Translate(f, language = "NewC")*

But when I run it, the "Multiply" function cannot be translated. The result is:

*Warning, type signature [CodeGeneration:-Names:-ArrayType(integer,CodeGeneration:-Names:-ArrayRanges(1 .. 2,1 .. 2),CodeGeneration:-Names:-ArrayOptions()), CodeGeneration:-Names:-ArrayType(integer,CodeGeneration:-Names:-ArrayRanges(1 .. 2,1 .. 2),CodeGeneration:-Names:-ArrayOptions())] for function Multiply is not recognized*

*void f (void)*

*{*

* int x[2][2];*

* int y[2][2];*

* x[0][0] = 1;*

* x[0][1] = 2;*

* x[1][0] = 3;*

* x[1][1] = 4;*

* y[0][0] = 1;*

* y[0][1] = 3;*

* y[1][0] = 4;*

* y[1][1] = 2;*

* Multiply(x, y);*

* ;*

*}*

I don't know why "Multiply(x,y)" cannot be translated.

If I put two "Multiply(x, y)" in the procedure, like this:

*f := proc ()*

*local x,y;*

*Multiply(x, y);*

*x := Matrix([[1, 2], [3, 4]]);*

*y := Matrix([[1,3],[4,2]]); *

*Multiply(x, y); *

*NULL; *

*end proc; *

*LanguageDefinition:-Define("NewC", extend = "C", AddFunction("Multiply", [Matrix,Matrix]::Matrix, *

*proc (X, Y) *

*local a; *

*a := 2; *

*b := convert(a, string); *

*Printer:-Print("Mmultiply(", X); *

*Printer:-Print(",", Y, ")"); Printer:-Print("\n"); *

*Printer:-Print("from", b, "to"); *

*Printer:-Print(",", Y, "do") end proc, numeric = double)); *

*Translate(f, language = "NewC")*

THe result is:

*Warning, cannot resolve types, reassigning x's type*

*Warning, cannot resolve types, reassigning y's type*

*Error, (in CodeGeneration:-IssueError) type 'Matrix' cannot be translated to target language*

I don't know why type 'Matrix' cannot be translated.