home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / softsys / matlab / 113 < prev    next >
Encoding:
Text File  |  1993-01-22  |  4.0 KB  |  81 lines

  1. Newsgroups: comp.soft-sys.matlab
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!Germany.EU.net!ubrinf!mathematik.uni-Bremen.de!bengt
  3. From: bengt@mathematik.uni-Bremen.de (Bengt Martensson)
  4. Subject: Re: Generating FORTRAN from MATLAB code ?
  5. Message-ID: <1993Jan22.111519.12108@informatik.uni-bremen.de>
  6. Sender: news@informatik.uni-bremen.de (NEWS Service)
  7. Nntp-Posting-Host: athena
  8. Organization: University of Bremen, Germany
  9. References: <28460@dog.ee.lbl.gov> <raghu.727577016@morgan>
  10. Date: Fri, 22 Jan 1993 11:15:19 GMT
  11. Lines: 68
  12.  
  13. In article <raghu.727577016@morgan>, raghu@morgan.ucs.mun.ca (Raghu B) writes:
  14. |> envwpk@epb2.lbl.gov (Werner P. Keilholz) writes:
  15. |> 
  16. |> >can anybody tell me if there is some way to automatically generate 
  17. |> >FORTRAN code from a program written with MATLAB ?
  18. |> 
  19. |> >This question came up in a discussion with a collegue who intends 
  20. |> >to develop numerical routines with MATLAB. I tried to talk him into 
  21. |> >using MAPPLE instead, because a salesperson once showed me a niffty 
  22. |> >little command, called 'FORTRAN', which generates the FORTRAN code
  23. |> >corresponing to a MAPPLE expression automatically. I know neither 
  24. |> >MAPPLE nor MATLAB, but I like the idea of directly using the routines 
  25. |> >written by my collegue instead of rewriting everything in FORTRAN
  26. |> o>or C (we want to use the result in a product that should be free of 
  27. |> 
  28. |>     Maple does give FORTRAN codes corresponding to Maple 
  29. |> expression. But you wouldn't want to use Maple to convert a Matrix
  30. |> expression into Fortran Codes. You are dead then. If you have
  31. |> say 10 x 10 matrix, Then FORTRAN will generate 100 Statements,
  32. |> to define that matrix. You wouldn't want to do that. Another way
  33. |> to reduce the no. of statements , is to use FORTRAN(xxx,optimize)
  34. |> which might help you to reduce the number of statements. Overall
  35. |> it is not an efficient way to generate FORTRAN codes, from
  36. |> MAPLE. It is just an additional feature in MAPLE but not a
  37. |> worthy one.
  38. |> 
  39. |>                     Raghu,B
  40. |> 
  41.  
  42. With optimization, Maple actually generates quite efficient Fortran
  43. (or C) code. As I understand it, there is quite some effort put into
  44. those routines. If the code looks hairy, it is because you are
  45. translating a problem to a low level language such as Fortran (or C).
  46.  
  47. To the point: If the problem is to convert a Matlab algorithm to a
  48. compiled language (for performance reasons e.g.) I believe that the
  49. best way would be to use a matrix class library in C++. In that way,
  50. you can write matrix operations like in Matlab, while enjoying the
  51. performance advantages of a compiled language. Since you don't have to
  52. translate matrix operations, lack of automatic translation is probably
  53. a minor issue.
  54.  
  55. One such matrix package was recently posted to comp.sources.misc,
  56. called newmat, written by Robert Davies <robertd@kauri.vuw.ac.nz>.
  57. There are also commercial packages available (e.g. Rogue Wave). 
  58. This is from the posting of newmat:
  59.  
  60.        Newmat is an experimental  matrix  package in  C++.  It supports  
  61.     matrix types: Matrix, UpperTriangularMatrix, LowerTriangularMatrix, 
  62.     DiagonalMatrix, SymmetricMatrix, RowVector, ColumnVector, BandMatrix,
  63.     UpperBandMatrix, LowerBandMatrix and SymmetricBandMatrix.   Only one 
  64.     element type (float or double) is supported.
  65.  
  66.        The package includes the operations *, +, -, (defined as operators)
  67.     inverse, transpose, conversion between types, submatrix, determinant,
  68.     Cholesky decomposition, Householder triangularisation, singular value
  69.     decomposition, eigenvalues of a symmetric matrix, sorting, fast Fourier
  70.     transform, printing, an interface with "Numerical Recipes in C" and an
  71.     emulation of exceptions.
  72.  
  73.        It is intended for matrices in the range 15 x 15 up to the size your
  74.     computer can store in one block.
  75.  
  76. -- 
  77. Bengt Mσrtensson                                +49 421 218-2952 (office)
  78. Institute for Dynamical Systems                 +49 421 17 17 13 (home)
  79. University of Bremen                            +49 421 218-4235 (fax)
  80. P.O. Box 330 440, D-2800 Bremen 33, Germany     bengt@mathematik.uni-Bremen.de
  81.