public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Problem with Cygwin installation: FAQ?
@ 2001-12-19 13:20 Adam Kleczkowski
  2001-11-19  0:05 ` Adam Kleczkowski
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Adam Kleczkowski @ 2001-12-19 13:20 UTC (permalink / raw)
  To: Gsl-Discuss

[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]

I am trying to install/compile/run GSL v. 1.0 in the Cygwin environment
(most up-to-date version), gcc 2.95.3-5. This has created a series of
various problems and I have not been successful so far.

Cygwin is installed in c:\cygwin

GSL libraries, include files etc in c:\cygwin\usr\bin etc, binaries in
c:\cygwin\bin

Testing by using example programs from the manual (pages referring to PDF
format):

Page 40:        poly.c (finding roots of the polynomial)
Page 162:       random.c (testing a random number generator)
Page 266:       vanderpol.c (Vanderpol oscilator)

Using the mingw installation.
All programs compile well, but:
a. poly.c executes with no problem
b. random.c and vanderpol.c crash giving the message:

      0 [main] A 86798653 handle_exceptions: Exception:
STATUS_ACCESS_VIOLATION
   1647 [main] A 86798653 open_stackdumpfile: Dumping stack trace to
RANDOM.EXE.stack
dump

I compile using simply
gcc -o random.exe -c random.c -lgsl -lm

I attach the programs. Any clues? In fact, I want to use random number
generators and ODE solver in my project, and these two have not compiled
well...
Thanks for a response in advance. If there is a reasonable FAQ that covers
the Cygwin installation, I would love to know where to find it. I tried to
compile GSL from the source under Cygwin (./configure, make, make install)
but run into horrific problems.
--
Adam Kleczkowski
Dept. Plant Sciences, University of Cambridge
e-mail: adam@kleczkowski.net
http://mathbio.com/ (work) http://kleczkowski.net/ (private)

[-- Attachment #2: vanderp.c --]
[-- Type: application/octet-stream, Size: 1354 bytes --]

#include <stdio.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_odeiv.h>
int
func (double t, const double y[], double f[], void *params)
{
double mu = *(double *)params;
f[0] = y[1];
f[1] = -y[0] - mu*y[1]*(y[0]*y[0] - 1);
return GSL_SUCCESS;
}
int
jac (double t, const double y[], double *dfdy, double dfdt[],
void *params)
{
double mu = *(double *)params;
gsl_matrix_view dfdy_mat = gsl_matrix_view_array (dfdy, 2, 2);
gsl_matrix_set (&dfdy_mat.matrix, 0, 0, 0.0);
gsl_matrix_set (&dfdy_mat.matrix, 0, 1, 1.0);
gsl_matrix_set (&dfdy_mat.matrix, 1, 0, -2.0*mu*y[0]*y[1] - 1.0);
gsl_matrix_set (&dfdy_mat.matrix, 1, 1, -mu*(y[0]*y[0] - 1.0));
dfdt[0] = 0.0;
dfdt[1] = 0.0;
return GSL_SUCCESS;
}
int
main (void)
{
const gsl_odeiv_step_type * T = gsl_odeiv_step_rk8pd;
gsl_odeiv_step * s = gsl_odeiv_step_alloc (T, 2);
gsl_odeiv_control * c = gsl_odeiv_control_y_new (1e-6, 0.0);
gsl_odeiv_evolve * e = gsl_odeiv_evolve_alloc (2);
double mu = 10;
gsl_odeiv_system sys = {func, jac, 2, &mu};
double t = 0.0, t1 = 100.0;
double h = 1e-6;
double y[2] = { 1.0, 0.0 } ;
gsl_ieee_env_setup();
while (t < t1)
{
int status = gsl_odeiv_evolve_apply(e, c, s, &sys, &t, t1, &h, y);
if (status != GSL_SUCCESS)
break;
printf("%.5e %.5e %.5e\n", t, y[0], y[1]);
}
gsl_odeiv_evolve_free(e);
gsl_odeiv_control_free(c);
gsl_odeiv_step_free(s);
}

[-- Attachment #3: random.c --]
[-- Type: application/octet-stream, Size: 352 bytes --]

#include <stdio.h>
#include <gsl/gsl_rng.h>
gsl_rng * r; /* global generator */

int main(void)
{
const gsl_rng_type * T;

gsl_rng_env_setup();
T = gsl_rng_rand48;
r = gsl_rng_alloc(T);
printf("generator type: %s\n", gsl_rng_name(r));
printf("seed = %u\n", gsl_rng_default_seed);
printf("first value = %u\n", gsl_rng_get(r));
return 0;
}

[-- Attachment #4: poly.c --]
[-- Type: application/octet-stream, Size: 372 bytes --]

#include <stdio.h>
#include <gsl/gsl_poly.h>
int
main ()
{
int i;
double a[6] = { -1, 0, 0, 0, 0, 1 }; /* P(x) = -1 + x^5 */
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]) ;
}
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2001-12-19 13:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-19 13:20 Problem with Cygwin installation: FAQ? Adam Kleczkowski
2001-11-19  0:05 ` Adam Kleczkowski
2001-12-19 13:20 ` Gerrit P. Haase
2001-11-20  3:02   ` Gerrit P. Haase
2001-12-19 13:20 ` Brian Gough
2001-11-19  9:00   ` Brian Gough
2001-12-19 13:20   ` Brian Gough
2001-12-19 13:20   ` [Gnuwin32-users] " GnuWin32
2001-11-20  0:58     ` GnuWin32
2001-12-19 13:20     ` Adam Kleczkowski
2001-11-20 10:13       ` Adam Kleczkowski
2001-12-19 13:20 ` Adam Kleczkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).