cornelison 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. From - Fri Dec 4 08:05:39 1998
  2. Received: from cliffy.statsci.com (root@cliffy.statsci.com [206.63.206.72]) by server.divms.uiowa.edu with id MAA14931 for <dstewart@math.uiowa.edu>; Thu, 3 Dec 1998 12:28:13 -0600 (CST)
  3. Received: from adlib2 (adlib2 [206.63.206.104])
  4. by cliffy.statsci.com (8.8.8/8.8.8/Hub) with SMTP id KAA28911;
  5. Thu, 3 Dec 1998 10:28:02 -0800
  6. Message-Id: <3.0.5.32.19981203102809.01371ec0@mailhost.statsci.com>
  7. X-Sender: johnc@mailhost.statsci.com
  8. X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32)
  9. Date: Thu, 03 Dec 1998 10:28:09 -0800
  10. To: David Stewart <dstewart@math.uiowa.edu>
  11. From: John Cornelison <johnc@statsci.com>
  12. Subject: Re: VStudio version of Meschach Library available?!
  13. Cc: Zbigniew Leyk <zleyk@wolfram.com>
  14. In-Reply-To: <36669B2E.809B959C@math.uiowa.edu>
  15. References: <3.0.5.32.19981202145120.0106bec0@mailhost.statsci.com>
  16. Mime-Version: 1.0
  17. Content-Type: text/plain; charset="us-ascii"
  18. X-Mozilla-Status: 8013
  19. X-Mozilla-Status2: 00000000
  20. Thanks for the fast reply. I'll send you another note once it's working.
  21. It now compiles fine into a .DLL with the following mods (hacks?!):
  22. The largest problem was figuring out to not include some of the
  23. miscellaneous source files that are used for QA & utility & legacy support.
  24. Once I read the makefile it was easy to set up. I'll send you the
  25. necessary project files once I complete things.
  26. As far as coding goes, in machine.h, right near the end, I've added:
  27. #ifndef WIN32
  28. #define LIBEXPORT
  29. #else
  30. /* Comment out the following line if NOT building Meschach.DLL! */
  31. /* TODO: Eventually this should be defined on the compile line only when
  32. building the DLL */
  33. #define DLLCREATION
  34. #ifdef DLLCREATION
  35. /* Including code is internal to the DLL */
  36. #define MLibImport _declspec(dllexport)
  37. #define MLibExport _declspec(dllimport)
  38. #define LIBEXPORT MLibImport
  39. #else
  40. /* Including code is external to the DLL */
  41. #define MLibImport _declspec(dllimport)
  42. #define MLibExport _declspec(dllexport)
  43. #define LIBEXPORT MLibExport
  44. #endif
  45. #ifdef WORDS_BIGENDIAN
  46. /* Win32 is always little endian */
  47. #undef WORDS_BIGENDIAN
  48. #endif
  49. #ifdef HUGE_VAL
  50. /* HUGE_VAL later defined in math.h */
  51. #undef HUGE_VAL
  52. #endif
  53. #if defined(_DEBUG) && defined(_MSC_VER)
  54. /* WARNING: Disabling the many "signed/unsigned mismatch" warnings so
  55. others stand out! */
  56. /* These happen when comparing an unsigned int with a regular signed int
  57. but should be fixed! */
  58. #pragma warning(disable:4018)
  59. #endif
  60. #endif /* WIN32 */
  61. The only significant thing here is to explicitly define what routines are
  62. being exported (or imported) from the DLL. This is done with Microsoft's
  63. delightful _declspec(dllexport) & _declspec(dllimport) expressions. Next I
  64. had to go through all function declarations & insert the LIBEXPORT define.
  65. Ideally this should ONLY be done for routines that are made publicly
  66. available from the library, i.e., not utility routines for internal use
  67. only, but I put it in all the declarations in sparse.h; err.h; iter.h;
  68. matrix.h; sparse2.h; meminfo.h. I left the complex libraries for another day.
  69. A sample of this is from the matrix.h file:
  70. /* miscellaneous functions */
  71. #ifndef ANSI_C
  72. extern double LIBEXPORT square(), cube(), mrand();
  73. extern void LIBEXPORT smrand(), mrandlist();
  74. extern void LIBEXPORT m_dump(), px_dump(), v_dump(), iv_dump();
  75. extern MAT LIBEXPORT *band2mat();
  76. extern BAND LIBEXPORT *mat2band();
  77. #else
  78. double LIBEXPORT square(double x), /* returns x^2 */
  79. cube(double x), /* returns x^3 */
  80. mrand(void); /* returns random # in [0,1) */
  81. void LIBEXPORT smrand(int seed), /* seeds mrand() */
  82. mrandlist(Real *x, int len); /* generates len random numbers */
  83. void LIBEXPORT m_dump(FILE *fp,MAT *a), px_dump(FILE *,PERM *px),
  84. v_dump(FILE *fp,VEC *x), iv_dump(FILE *fp, IVEC *ix);
  85. MAT LIBEXPORT *band2mat(BAND *bA, MAT *A);
  86. BAND LIBEXPORT *mat2band(MAT *A, int lb,int ub, BAND *bA);
  87. #endif
  88. It is sort of ugly, and I probably messed up all your formatting but it at
  89. least works and won't break things on other platforms. The only warnings
  90. that now appear during a full compilation (again, I've left out all the
  91. z*.c routines) are:
  92. Deleting intermediate files and output files for project 'Meschach - Win32
  93. Debug'.
  94. --------------------Configuration: Meschach - Win32 Debug--------------------
  95. Compiling...
  96. bdfactor.c
  97. bkpfacto.c
  98. chfactor.c
  99. copy.c
  100. err.c
  101. D:\Meschach\Source\err.c(328) : warning C4113: 'void (__cdecl *)()' differs
  102. in parameter lists from 'void (__cdecl *)(int )'
  103. D:\Meschach\Source\err.c(337) : warning C4113: 'void (__cdecl *)()' differs
  104. in parameter lists from 'void (__cdecl *)(int )'
  105. fft.c
  106. givens.c
  107. hessen.c
  108. hsehldr.c
  109. init.c
  110. iter0.c
  111. iternsym.c
  112. itersym.c
  113. D:\Meschach\Source\itersym.c(424) : warning C4113: 'int (__cdecl *)()'
  114. differs in parameter lists from 'int (__cdecl *)(const void *,const void *)'
  115. ivecop.c
  116. lufactor.c
  117. machine.c
  118. matlab.c
  119. matop.c
  120. matrixio.c
  121. meminfo.c
  122. memory.c
  123. memstat.c
  124. mfunc.c
  125. D:\Meschach\Source\mfunc.c(174) : warning C4244: '=' : conversion from
  126. 'double ' to 'int ', possible loss of data
  127. norm.c
  128. otherio.c
  129. pxop.c
  130. qrfactor.c
  131. schur.c
  132. D:\Meschach\Source\schur.c(158) : warning C4101: 't' : unreferenced local
  133. variable
  134. solve.c
  135. sparse.c
  136. sparseio.c
  137. spbkp.c
  138. D:\Meschach\Source\spbkp.c(1244) : warning C4113: 'int (__cdecl *)()'
  139. differs in parameter lists from 'int (__cdecl *)(const void *,const void *)'
  140. spchfctr.c
  141. splufctr.c
  142. sprow.c
  143. spswap.c
  144. submat.c
  145. svd.c
  146. symmeig.c
  147. update.c
  148. vecop.c
  149. version.c
  150. Linking...
  151. Creating library Debug/Meschach.lib and object Debug/Meschach.exp
  152. Creating browse info file...
  153. Meschach.dll - 0 error(s), 6 warning(s)
  154. At 08:07 AM 12/3/98 -0600, David Stewart wrote:
  155. >John Cornelison wrote:
  156. >>
  157. >> Hi, I'm starting to get the library to work in the Win32 environment and
  158. >> was curious if you are aware of anyone else that may have done this
  159. already.
  160. >>
  161. >> Specifically I'd appreciate pointers to anyone that has wrapped this into a
  162. >> Visual Studio project. I know Visual Studio is super platform specific so
  163. >> is not something you are likely to promote, but knowing about this would
  164. >> save us some time.
  165. >>
  166. >> Also I understand from the readme that you have an electronic form of the
  167. >> manual I can ask for. If easy, I would appreciate a copy of that. We are
  168. >> using the sparse matrix processing functionality for a small research
  169. >> project we're considering and getting improvements of many magnitudes over
  170. >> our previous techniques.
  171. >>
  172. >> Thanks in advance for doing all this incredible work!
  173. >>
  174. >> -John
  175. >
  176. >You can get a **partial** on-line manual via
  177. >
  178. > http://www.math.uiowa.edu/~dstewart/meschach/
  179. >
  180. >However, this doesn't include the sparse matrix stuff.
  181. >There have been some others who have worked on MS-DOS ports of
  182. >Meschach. However, I haven't been keeping up with the status of these
  183. >efforts. And I ceratinly haven't heard of anyone using it in
  184. >Visual Studio. Zbigniew and I are glad to hear of another happy
  185. >user though!
  186. >
  187. >Neither Zbigniew nor I have had much time to devote to Meschach
  188. >in the past few years, which has (unfortunately) stalled its
  189. >development... You should also look for matrix re-ordering techniques
  190. >(I have some code for the Gibbs-Poole-Stockmeyer method for
  191. >Meschach, if you would like that. Someone else developed it,
  192. >so I can't say much regarding it; the algorithm is not the best
  193. >matrix re-ordering technique for general sparse matrices, but
  194. >it definitely better than standard orderings for most problems.)
  195. Sure, if convenient, I would appreciate getting this.
  196. >Also: please note the new email addresses!
  197. >
  198. > -- David Stewart
  199. Thanks again for developing the library!
  200. ----------------------------------------------------------------------------
  201. http://www.MathSoft.com, Data Analysis Products Division
  202. 1700 Westlake Av N, Suite 500, Seattle, WA 98109-3012
  203. 206.283.8802x243, 283.8691fax, johnc@statsci.com, NIC JHC7
  204. ----------------------------------------------------------------------------