[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Root finding for systems of the type R^n -> R

From: Vale Cofer-Shabica
Subject: [Help-gsl] Root finding for systems of the type R^n -> R
Date: Fri, 12 Jul 2013 15:08:51 -0400

I've read through the root-finding documentation, but didn't find a
reference to this case. Any assistance would be appreciated.

I get "gsl: lu.c:147: ERROR: matrix is singular" when tying to find
the zeros of a function from R^n -> R using the functionality in

How should I proceed?

I'm trying to find the zeros of mufti dimensional (anywhere from 2 to
1500 degrees of freedom) potential-energy-type functions, which map
vectors to scalars. To that end, I started trying to set up the
gsl_multiroot_function_fdf struct for use with the Newton-Raphson

However, when implementing

int (* df) (const gsl_vector * x, void * params, gsl_matrix * J)

to produce the Jacobian, I was concerned. Because my function is
scalar valued only the the first row of partial derivatives has any
meaning. I used code like this:

//only row 0 has non-zero elements
gsl_matrix_set_all (J, 0.0);
//grad is a gsl_vector * containing the gradient
gsl_matrix_set_row (J, (size_t) 0, grad);

to input the part of the Jacobian that exists.
I used similar code for the function itself:

//all elements but the first are 0
gsl_vector_set_all (f, 0.0);
// energy is a double holding the value of the function
gsl_vector_set (f, (size_t) 0, energy);

I filled the vector with 0 and wrote the first element with the
function's value.

My code compiles without warnings or errors using the recommend (gsl
manual A.4 [1]) flags with gcc. However, when executing, I get the
following error:

 $ ./a.out
gsl: lu.c:147: ERROR: matrix is singular
Default GSL error handler invoked.

How should I express my function so I can avoid this?

Thanks very much,


Vale Cofer-Shabica
Department of Chemistry, Brown University

reply via email to

[Prev in Thread] Current Thread [Next in Thread]