>> From: Alec Mihailovs "amihailo"
That depends on the compiler you use.
If you use Visual Studio 6, then the most simple way is
to open Notepad, copy the program 'void multiply',
and save it, say, in C:\MyProjects\MulMat as MulMat.c.
After that, click on Vcvars32.bat located in
C:\Program Files\Microsoft Visual Studio\VC98\Bin
and change the folder to the location of MulMat.c. For the
example above, type
cd C:\MyProjects\MulMat
After that, enter the command producing the dll:
cl -LD -Gz -Gy -FeMulMat.dll MulMat.c -link /export:multiply
Using Maple 7, the example of using the dll in the extcm6.html
should be changed as follows:
> multiplyMatrixModp := define_external(
> 'multiply',
> a::ARRAY(1..i,1..j,integer[4]),
> b::ARRAY(1..j,1..k,integer[4]),
> c::REF(ARRAY(1..i,1..k,integer[4]),RETURN_ONLY),
> i::integer[4],
> j::integer[4],
> k::integer[4],
> p::integer[4],
> LIB="C:/MyProjects/MulMat/MulMat.dll"):
> p := 17:
> A := Matrix(100,100,(i,j)->i+j mod p,datatype=integer[4]):
> B := Matrix(100,100,(i,j)->i*j mod p,datatype=integer[4]):
> C := Matrix(100,100,datatype=integer[4]):
> multiplyMatrixModp(A,B,C,100,100,100,p);
Note that C is not AB, but BA mod 17. For example,
> E:=Matrix([[1,2],[3,4]],datatype=integer[4]);
[1 2]
E := [ ]
[3 4]
> F:=Matrix([[0,1],[2,3]],datatype=integer[4]);
[0 1]
F := [ ]
[2 3]
> G:=Matrix(2,2,datatype=integer[4]):
> multiplyMatrixModp(E,F,G,2,2,2,p);
> G;
[ 3 4]
[ ]
[11 16]
Best wishes,
Alec Mihailovs
http://webpages.shepherd.edu/amihailo/
-----Original Message-----
>> From: "bguerrieri"
I am hiding behind a fence as I ask this question about calling C
procedures from Maple:
On the Maple site
http://www.mapleapps.com/categories/software/c_code/html/extcm6.html
one has kindly posted part of the answer pertaining to the
multiplication of two matrices.
|