Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

GNU Scientific Library - has anybody used it?

For help or questions about 64-bit version of MEPIS, this is the forum to use.
Post Reply
Message
Author
User avatar
eemaestro
Forum Guide
Forum Guide
Posts: 1010
Joined: Wed Aug 02, 2006 12:12 pm

GNU Scientific Library - has anybody used it?

#1 Post by eemaestro » Tue Jun 16, 2015 4:15 pm

Trying to install the GNU Scientific Library for gcc (and later will do the same for g++)
in order to run the example program listed here under Linking to gsl
http://gribblelab.org/CBootcamp/A1_Libraries.html
I already have both gcc and g++ installed.

So I tried the suggestion here (install gsl-bin)
http://askubuntu.com/questions/490465/i ... a-terminal

Code: Select all

# apt-get install gsl-bin    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libwebrtc-audio-processing-0
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  libgsl0ldbl
Suggested packages:
  gsl-ref-psdoc gsl-doc-pdf gsl-doc-info gsl-ref-html
The following NEW packages will be installed:
  gsl-bin libgsl0ldbl
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 1,161 kB of archives.
After this operation, 2,945 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.us.debian.org/debian/ wheezy/main libgsl0ldbl amd64 1.15+dfsg.2-2 [1,132 kB]
Get:2 http://ftp.us.debian.org/debian/ wheezy/main gsl-bin amd64 1.15+dfsg.2-2 [29.0 kB]
Fetched 1,161 kB in 1s (930 kB/s)  
Selecting previously unselected package libgsl0ldbl.
dpkg: warning: files list file for package 'xfsprogs' missing; assuming package has no files currently installed
(Reading database ... 121637 files and directories currently installed.)
Unpacking libgsl0ldbl (from .../libgsl0ldbl_1.15+dfsg.2-2_amd64.deb) ...
Selecting previously unselected package gsl-bin.
Unpacking gsl-bin (from .../gsl-bin_1.15+dfsg.2-2_amd64.deb) ...
Processing triggers for man-db ...
Setting up libgsl0ldbl (1.15+dfsg.2-2) ...
Setting up gsl-bin (1.15+dfsg.2-2) ...

Code: Select all

$ gcc -o go go.c -lgsl -lgslcblas
go.c:6:28: fatal error: gsl/gsl_linalg.h: No such file or directory
compilation terminated.
$ cat go.c
// go.c de http://gribblelab.org/CBootcamp/A1_Libraries.html
// gcc -o go go.c -lgsl -lgslcblas
// see also http://www.gnu.org/software/gsl/manual/html_node/Linear-Algebra-Examples.html

#include <stdio.h>
#include <gsl/gsl_linalg.h>

int main (void)
{
  double a_data[] = { 0.18, 0.60, 0.57, 0.96,
                      0.41, 0.24, 0.99, 0.58,
                      0.14, 0.30, 0.97, 0.66,
                      0.51, 0.13, 0.19, 0.85 };

  double b_data[] = { 1.0, 2.0, 3.0, 4.0 };

  gsl_matrix_view m 
    = gsl_matrix_view_array (a_data, 4, 4);

  gsl_vector_view b
    = gsl_vector_view_array (b_data, 4);

  gsl_vector *x = gsl_vector_alloc (4);

  int s;

  gsl_permutation * p = gsl_permutation_alloc (4);

  gsl_linalg_LU_decomp (&m.matrix, p, &s);

  gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x);

  printf ("x = \n");
  gsl_vector_fprintf (stdout, x, "%g");

  gsl_permutation_free (p);
  gsl_vector_free (x);
  return 0;
}
I suppose I could install the other three packages mentioned on the ubuntu forum w/ APT:
  • libgsl0-dbg: GNU Scientific Library (GSL) -- debug symbols package
  • libgsl0-dev: GNU Scientific Library (GSL) -- development package
  • libgsl0ldbl: GNU Scientific Library (GSL) -- library package
and see if that does the trick. I just thought I'd ask first if anybody had already gone down this path--used GSL libraries/header files. I prefer to work smart rather than hard.
Unfortunately, I'm not the sharpest tool in the shed. So that doesn't always work out so well.

User avatar
kmathern
Forum Veteran
Forum Veteran
Posts: 9318
Joined: Wed Jul 12, 2006 2:26 pm

Re: GNU Scientific Library - has anybody used it?

#2 Post by kmathern » Tue Jun 16, 2015 4:21 pm

My guess is that you need to install libgsl0-dev.

User avatar
eemaestro
Forum Guide
Forum Guide
Posts: 1010
Joined: Wed Aug 02, 2006 12:12 pm

Re: GNU Scientific Library - has anybody used it?

#3 Post by eemaestro » Fri Jun 19, 2015 12:09 pm

I tried your suggestion, kmathern. gcc worked, no errors, no warnings.
The program gave me the exact four values listed at
http://gribblelab.org/CBootcamp/A1_Libraries.html
Thank you, kmathern, for pointing me in the right direction.
Good job! You have been a big help, and I really appreciate it.

Post Reply

Return to “64-bit Regulars”