numlib.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. {
  2. $Id: numlib.txt,v 1.2 2002/09/07 15:43:04 peter Exp $
  3. This file is part of the Numlib package.
  4. Copyright (c) 1986-2000 by
  5. Kees van Ginneken, Wil Kortsmit and Loek van Reij of the
  6. Computational centre of the Eindhoven University of Technology
  7. FPC port Code by Marco van de Voort ([email protected])
  8. Documentation by Michael van Canneyt ([email protected])
  9. This is an internal document with information collected during porting
  10. numlib to FPC
  11. See the file COPYING.FPC, included in this distribution,
  12. for details about the copyright.
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. **********************************************************************}
  17. NumLib ported.txt, internals or "Developpers docs".
  18. ARBFLOAT, basic Floating point type.
  19. -----------------------------------
  20. In the FPC revision instead of picking a certain floating point type,
  21. a new type "ArbFloat" is defined which is used as floating point type
  22. throughout the entire library. If the floating point type is changed,
  23. define or undefine ArbExtended and add the machineconstants change to
  24. the type selected.
  25. This allows to switch between IEEE Double (64bit) and Extended(80bit),
  26. though big endian state is unknown (and probably needs refactoring the
  27. examples to an automated testsuite first)
  28. ARBINT, basic INTEGER type.
  29. -----------------------------------
  30. Because in plain FPC mode Integer =16-bits (for TP compatibility), and in
  31. Delphi 32-bits, I changed all integers to ArbInt.
  32. The basic idea is the same as ArbFloat, but it is less consequently used,
  33. mainly because some typecastings of pointers to words existed. These
  34. typecastings should never be 16-bits in FPC, so all local variables are
  35. longint. (which is currently always 32bits)
  36. VECTOR or MATRIX as ArbFloat.
  37. -----------------------------------
  38. NumLib often passes Matrices and Vectors as one ArbFloat + some integer
  39. values, then maps the following pmatrix type over it, and accesses it as an
  40. array or vector:
  41. procedure dosomething(var invalue:ArbFloat);
  42. type Row=ARRAY[0..maxelements] OF ArbFloat;
  43. Matrix=Array[0..maxelements] OF ^ROW;
  44. pmatrix=^matrix;
  45. Var pa : pmatrix;
  46. begin
  47. pa=@invalue;
  48. pa[x]^[y]:=valuexy
  49. END;
  50. The calling side looks like this:
  51. VAR L : ARRAY[0..1999] OF ArbFloat;
  52. DoSomething(L[0]);
  53. Documentation
  54. -------------
  55. Needs fpc.sty and fakehtml.sty from FPC documentation source to build.
  56. For now in latex (due to math formulas etc), and file per unit, later then
  57. can be combined in one hyperrefed pkg
  58. -----------
  59. Questions that remain open/incompleteneses in the package we got:
  60. - Typ, mdt and Dsl,spl are undocumented. Typ is quite understandable though.
  61. Mdt and dsl contain probably procedures that, in earlier version were
  62. used as locals in some unit. When the procedures were also used in other units,
  63. they were moved to a different unit, but the documentation wasn't extended.
  64. SPL is different in many ways. Contains comments (including some english
  65. ones)
  66. - All procedures with an extra l appended to the name in unit SLE are
  67. undocumented.
  68. - The archive we got seems to be a copy of the working directory of the author,
  69. a snapshot during a never finished restructure. (probably matlab and
  70. similar programs took over)
  71. The sources/finished directory was the "new" archive, which generated a
  72. .dll. All graphics using routines, and new units were never finished.
  73. The problem is that also the documentation was never finished.
  74. - How to implement a less ugly calling convention, without loosing speed.
  75. (which still can be important in nummerics)?
  76. Other remarks:
  77. - Spe needs some constants recalculated to get full precision for extended,
  78. the files to calc the constants aren't included. (copied from some reference
  79. book?) Some units have literature references in the documentation. Spe
  80. (Murphy's law) doesn't. Some other units (INT) also have this problem.
  81. - Found out what MDT does. MDT is the core of DET. Det just reads a vector,
  82. reformats it to form a matrix, and then passes it to MDT.
  83. Such a vector only contains the required fields to build a certain kind of
  84. matrix. (e.g. for a band matrix, the diagonals). MDT=Matrix determinant.