## [Mingw-users] [mingw - C/C++] RE: using GNU gsl library?

 [Mingw-users] [mingw - C/C++] RE: using GNU gsl library? From: SourceForge.net - 2004-05-25 13:53:27 ```Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2585307 By: yxi Sorry to bother again. I have something new. I also tested the polynomial solver and two bessel function examples, and just found that the two programs for bessel functions did work under MinGW gcc and outputs are exactly as they should be. But the code for polynomial root solver still behaved same as my matrix example. (All compiling steps are same as previous one). I attached the code again. Seems something is wrong with the memory allocation under my MinGW? How can I examine further? Thank you very much for any help! yxi (Yingfu) /*Program for polynomail roots solver*/ #include #include int main (void) { int i; /* coefficient of P(x) = -1 + x^5 */ double a[6] = { -1, 0, 0, 0, 0, 1 }; double z[10]; gsl_poly_complex_workspace * w = gsl_poly_complex_workspace_alloc (6); gsl_poly_complex_solve (a, 6, w, z); gsl_poly_complex_workspace_free (w); for (i = 0; i < 5; i++) { printf ("z%d = %+.18f %+.18f\n", i, z[2*i], z[2*i+1]); } return 0; } /*end of pplynomial solver*/ /*program for bessel function 1*/ #include #include #include int main (void) { double x = 5.0; gsl_sf_result result; double expected = -0.17759677131433830434739701; int status = gsl_sf_bessel_J0_e (x, &result); printf ("status = %s\n", gsl_strerror(status)); printf ("J0(5.0) = %.18f\n" " +/- % .18f\n", result.val, result.err); printf ("exact = %.18f\n", expected); return status; } /*program for bessel function 2*/ #include #include int main (void) { double x = 5.0; double expected = -0.17759677131433830434739701; double y = gsl_sf_bessel_J0 (x); printf ("J0(5.0) = %.18f\n", y); printf ("exact = %.18f\n", expected); return 0; } ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 ```

 RE: [Mingw-users] [mingw - C/C++] using GNU gsl library? From: Anand, Vaidyanathan R - 2004-05-24 18:31:03 ```Without details, it is hard to tell what is wrong with your program, eg. is there a problem with the sample program compilation or the gsl library as built. However, I used the version of gsl (1.0.1) from the GnuWin32 project (http://gnuwin32.sf.net/packages/gsl.htm) and used it to compile the first sample program for matrices from the gsl documentation. The output was exactly as described in the manual. Hope this helps. Regards, Anand -----Original Message----- From: SourceForge.net [mailto:noreply@...]=20 Sent: Monday, May 24, 2004 9:47 AM To: noreply@... Subject: [Mingw-users] [mingw - C/C++] using GNU gsl library? Read and respond to this message at:=20 https://sourceforge.net/forum/message.php?msg_id=3D2583886 By: yxi Hello, all, I got a problem using GNU scientific library gsl. Do you also use it? I test the first example programs for matrices in gsl's manual. I compiled and ran it quite easily with cygwin gcc (my gsl library is installed into cygwin defaultly). And I also succeeded in compiling and linking it under MinGW gcc compiler, specifying the headfile path and library path, and got the a.exe. However, when I executed it, forever silence waited for me... Have I done something wrong? Thanks a lot in advance for any help. Regards, Yxi ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit:=20 https://sourceforge.net/forum/unmonitor.php?forum_id=3D286529 ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick _______________________________________________ MinGW-users mailing list MinGW-users@... You may change your MinGW Account Options or unsubscribe at: https://lists.sourceforge.net/lists/listinfo/mingw-users ```
 [Mingw-users] [mingw - C/C++] RE: using GNU gsl library? From: SourceForge.net - 2004-05-24 19:01:22 ```Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2584061 By: earnie Does ``start a.exe'' work better as far as user interaction? Earnie. ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 ```
 RE: [Mingw-users] [mingw - C/C++] using GNU gsl library? From: Yingfu Xie - 2004-05-25 07:42:09 ```Thank you all. Sorry, I should tell you my systems info. My gsl is 1.4-2, and installed together with cygwin gcc 3.3.1 (cygming special). And my MinGW gcc is 3.2.3(mingw special 20030504-1). All of them are installed into default directory, namely, the gsl header files are in /usr/include/gsl, and libraries are in /lib. I compiled the matrix example program with MinGW gcc -c test.c -I"c:\cygwin\usr\include" gcc test.o -L"c:\cygwin\lib" -lgsl -lgslcblas -lm No errors at all. I compiled with cygwin gcc all the same except not specifying the directories and the output is also as the manual. For eaay reference, I also attached the code below. I hope you can point out my bad now. Regards, Yingfu (yxi) -----Original Message----- From: Anand, Vaidyanathan R [mailto:vaidyanathan.r.anand@...] Sent: den 24 maj 2004 20:02 To: mingw-users@... Subject: RE: [Mingw-users] [mingw - C/C++] using GNU gsl library? Without details, it is hard to tell what is wrong with your program, eg. is there a problem with the sample program compilation or the gsl library as built. However, I used the version of gsl (1.0.1) from the GnuWin32 project (http://gnuwin32.sf.net/packages/gsl.htm) and used it to compile the first sample program for matrices from the gsl documentation. The output was exactly as described in the manual. Hope this helps. Regards, Anand ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. ########################################### ```
 [Mingw-users] [mingw - C/C++] RE: using GNU gsl library? From: SourceForge.net - 2004-05-25 08:53:45 ```Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2584881 By: yxi Thanks. Using 'start a.exe' pops up a new command window but still silent... Sorry, I forgot attaching the code. Here it is: #include #include int main(void) { int i,j; gsl_matrix * m=gsl_matrix_alloc(10,3); for(i=0;i<10;i++) for (j=0;j<3;j++) gsl_matrix_set(m,i,j,0.23+100*i+j); for(i=0;i<100;i++) for (j=0;j<3;j++) printf("m(%d,%d)=%g\n",i,i,gsl_matrix_get(m,i,j)); return 0; } Regards, Yxi ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 ```
 [Mingw-users] [mingw - C/C++] RE: using GNU gsl library? From: SourceForge.net - 2004-05-25 13:53:27 ```Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2585307 By: yxi Sorry to bother again. I have something new. I also tested the polynomial solver and two bessel function examples, and just found that the two programs for bessel functions did work under MinGW gcc and outputs are exactly as they should be. But the code for polynomial root solver still behaved same as my matrix example. (All compiling steps are same as previous one). I attached the code again. Seems something is wrong with the memory allocation under my MinGW? How can I examine further? Thank you very much for any help! yxi (Yingfu) /*Program for polynomail roots solver*/ #include #include int main (void) { int i; /* coefficient of P(x) = -1 + x^5 */ double a[6] = { -1, 0, 0, 0, 0, 1 }; double z[10]; gsl_poly_complex_workspace * w = gsl_poly_complex_workspace_alloc (6); gsl_poly_complex_solve (a, 6, w, z); gsl_poly_complex_workspace_free (w); for (i = 0; i < 5; i++) { printf ("z%d = %+.18f %+.18f\n", i, z[2*i], z[2*i+1]); } return 0; } /*end of pplynomial solver*/ /*program for bessel function 1*/ #include #include #include int main (void) { double x = 5.0; gsl_sf_result result; double expected = -0.17759677131433830434739701; int status = gsl_sf_bessel_J0_e (x, &result); printf ("status = %s\n", gsl_strerror(status)); printf ("J0(5.0) = %.18f\n" " +/- % .18f\n", result.val, result.err); printf ("exact = %.18f\n", expected); return status; } /*program for bessel function 2*/ #include #include int main (void) { double x = 5.0; double expected = -0.17759677131433830434739701; double y = gsl_sf_bessel_J0 (x); printf ("J0(5.0) = %.18f\n", y); printf ("exact = %.18f\n", expected); return 0; } ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 ```
 RE: [Mingw-users] [mingw - C/C++] using GNU gsl library? From: Yingfu Xie - 2004-05-25 17:07:49 ```Thank you very much! You are definitely right; all examples work for me with cygwin also. And you are also right that although I installed gsl standard into Cygwin, what I really want now is MinGW compiler, because building a DLL to be loaded into statistical S-plus is not supported by Cygwin gcc compiler any longer. And I have already downloaded the GnuWin32 gsl you recommended and tested all examples, all succeeded. So my problem is solved, only some curiosity remaining: what really happened? Thank you all for your efforts again. Regards, Yingfu (yxi) -----Original Message----- From: Anand, Vaidyanathan R [mailto:vaidyanathan.r.anand@...] Sent: den 25 maj 2004 18:48 To: Yingfu Xie Subject: RE: [Mingw-users] [mingw - C/C++] using GNU gsl library? I believe your problem is due to incorrect mixing of Cygwin and MinGW compiler include and library paths. From your description, the version of gsl that you have (1.4-2) is the Cygwin version, downloaded and installed with the Cygwin setup program. The gsl header files and libraries are then installed in the standard Cygwin locations (/usr/include, /usr/lib) and you do not need to use gsl include or library paths in your compiler command line. You can then compile your program with the Cygwin compiler as follows: gcc -o test test.c -lgsl -lgslcblas -lm I have tried all four of your test programs this way and they all work correctly as they should. If you wish to use the CYGMING option, the correct way to compile is: gcc -o test -DCYGMING=on test.c -lgsl -lgslcblas -lm I have also tried all four of your test programs this way and they work. Using the CYGMING option invokes the MinGW option in Cygwin (I believe it works correctly for gcc although I am not sure if it can also be used for g++ and g77). There seems to be no benefit to using this option here since you are linking with the installed version of gsl which is definitely a Cygwin build. However, it appears that what you have tried to do is to compile your test programs with the MinGW compiler and forced it to find the Cygwin-installed gsl by adding -I and -L pointing to the Cygwin gsl. I tried this with one of your test programs and, surprisingly, it does create an executable (I expected lots of errors). And the program does hang, just as you found. Using -Ic:\cygwin\usr\include and -Lc:\cygwin\usr\lib forces the MinGW compiler to search the Cygwin headers and libraries before its own MinGW headers and libraries, which is DEFINITELY NOT the right thing to do! So please do one of the following: 1. If you wish to use the Cygwin compiler, then compile your test programs as in my first trial above. 2. If you wish to use the MinGW compiler, you can download and install the native Windows build of gsl from the GnuWin32 project (http://gnuwin32.sf.net/packages/gsl.htm, which was version 1.0.1 the last time I checked), or download the gsl source code from any GNU download site and build it using MinGW and MSYS (you will probably need the MSYS-DTK package to give you many of the extra utilities that you get with Cygwin). I would recommend the pre-built GnuWin32 gsl; although it is an earlier version, it may be adequate for what you are trying to do and it saves you from the trouble of building gsl from source. Hope this helps. Regards, Anand ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. ########################################### ```
 [Mingw-users] [mingw - C/C++] RE: using GNU gsl library? From: SourceForge.net - 2004-08-30 12:05:55 ```Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=2735676 By: useradd Do you use cygwin or only use mingw. I can compile and run all your code with mingw gcc 3.4.0 with gsl 1.5(compiled by myself). ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=286529 ```