-2

I recently installed GSL for use in my computing homework. I installed it from a pre built library and linked it to CodeBlocks, then ran the test example for GSL (the bessel function) to make sure it worked. Everything going fine.

Then I tried the example for linear algebra given here: https://www.gnu.org/software/gsl/manual/html_node/Linear-Algebra-Examples.html#Linear-Algebra-Examples

I get an odd error message:

gls: ..\linalg\lu.c:63: ERROR: LU decomposition requires square matrix
Default GSL error handler invoked.

This application has requested the Runtime to terminate in an unusual way.
Please contact the application's support team for more information.

Then the program crashes with a 225 error code.

Putting in markers, I know my program makes it to the decomposition command before failing (which would be a good guess from the error code).

This has been confirmed by 2 of 3 people. One runs a Windows machine with code blocks like me, and uses the same pre built package I do. The other runs on a mac with a different piece of software to write, compile, and run his C. The third person is on Windows again, used the same prebuilt installation, but his runs fine in codeblocks, so I don't know what the thing is there.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Alex Howard
  • 319
  • 3
  • 13

1 Answers1

0

Looking at the file and line in your error message we can see:

int
gsl_linalg_LU_decomp (gsl_matrix * A, gsl_permutation * p, int *signum)
{
    if (A->size1 != A->size2)
    {
        GSL_ERROR ("LU decomposition requires square matrix", GSL_ENOTSQR);
    }

The code is checking to insure that the inputted matrix is a square matrix (i.e. same number of rows and columns). Furthermore, if we peek inside gsl_errno.h we can find the defination of GSL_ERROR as:

#define GSL_ERROR(reason, gsl_errno) \
       do { \
       gsl_error (reason, __FILE__, __LINE__, gsl_errno) ; \
       return gsl_errno ; \
    } while (0)

So in effect, an error message is shown, and then GSL_ERROR causes your program to exit and returns an error code to the shell.

At this point, if I had to guess, you failed to copy the example program that you linked into your development environment correctly, as a_data does define a square matrix.

Hope this helps
T.

thurizas
  • 2,473
  • 1
  • 14
  • 15
  • Thanks for the reply. Unfortunately that didnt help. I didnt retype the example, but instead dragged the whole thing as one, so I dont see that as a source of errors. Ill have another look though. – Alex Howard Dec 11 '15 at 17:45