[fpc-pascal] Optimized matrix multiplication functions for pascal?
Sven Barth
pascaldragon at googlemail.com
Sun Oct 10 13:51:49 CEST 2010
Am 09.10.2010 07:59, schrieb Bo Berglund:
> I am translating a bunch of Fortran functions to FPC and I
> have now come across a problem with a couple of built-in
> Fortran90 functions:
>
> MATMUL multiplies two matrices (arrays) and returns the result.
>
> TRANSPOSE reorders the array elemsnts in some predefined way.
>
> The call in the Fortran routine is like this:
>
> b = matmul(transpose(a), a)
>
> where a and b are equal sized dynamic arrays of double.
>
> So I need to get hold of two Delphi functions:
>
> function matmul(X, Y: array of double): array of double;
> and
> function transpose(X: array of double): array of double;
>
> Where can I find such functions?
> I am not a matematician myself so I don't know what these
> functions really do...
>
Try the unit matrix.pp which is part of FPC's RTL. It also includes
overloaded operators if you need them. ^^
(In Lazarus: enter the unit name in the uses clause and do a Ctrl+left
mouse button on it to view its contents)
Regards,
Sven
More information about the fpc-pascal
mailing list