# Optimized matrix multiplication functions for pascal? Classic List Threaded 7 messages Open this post in threaded view
|

## Optimized matrix multiplication functions for pascal?

 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... -- Bo Berglund _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Open this post in threaded view
|

## Re: Optimized matrix multiplication functions for pascal?

 On 09/10/2010 06:59, Bo Berglund wrote: > 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: http://paginas.fe.up.pt/~paco/pmwiki/index.php?n=DynMatrix.DynMatrixIt is a bit more than just those functions but it could solve, for a while, your problem. Paulo Costa _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Open this post in threaded view
|

## Re: Optimized matrix multiplication functions for pascal?

 In reply to this post by Bo Berglund On Sat, 9 Oct 2010 07:59:26 +0200, Bo Berglund wrote about [fpc-pascal] Optimized matrix multiplication functions for pascal?: [snip] > Where can I find such functions? They are available in a library named LAPACK.  You can find downloads by doing a Google search on this name.  It is coded in FORTRAN though. > I am not a matematician myself so I don't know what these > functions really do... They are easy to code, as they are simple linear algebra.  A good textbook on linear algebra would be a great help to you. However, LAPACK gets mighty complicated when it gets into other areas of numerical linear algebra.  If your FORTRAN code uses more complicated routines, you might find it convenient simply to call the LAPACK FORTRAN code directly.  Maintaining a Pascal version of LAPACK would be a non-trivial -- even arduous -- task, but you could check the FPC Wiki to see if somebody might already have done that for you. -- Regards, Dave  [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* [hidden email] (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal signature.asc (205 bytes) Download Attachment
Open this post in threaded view
|

## Re: Optimized matrix multiplication functions for pascal?

 David W Noon wrote: > On Sat, 9 Oct 2010 07:59:26 +0200, Bo Berglund wrote about [fpc-pascal] > Optimized matrix multiplication functions for pascal?: > > [snip] >> Where can I find such functions? > > They are available in a library named LAPACK.  You can find downloads > by doing a Google search on this name.  It is coded in FORTRAN though. There is also a C version of LAPACK, see with prebuilt Windows libraries . It should be possible to call into those libs from FPC. Regards, Adriaan van Os _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Open this post in threaded view
|

## Re: Optimized matrix multiplication functions for pascal?

 In reply to this post by Bo Berglund 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 _______________________________________________ fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/mailman/listinfo/fpc-pascal