Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

How to install gsl in ubuntu 20.04?

3 Answer(s) Available
Answer # 1 #

First of all update your system with the command:

Ads

Above command will download the package lists for Ubuntu 20.04 LTS on your system. This will update the list of newest versions of packages and its dependencies on your system.

After downloading the latest package list with the help of above you can run the installation process.

If gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign is not installed on your compter then the command 'dpkg -L gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign' will give followin error.

Installing gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign:

After system update use the following command to install gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign:

Above command will confirm before installing the package on your Ubuntu 20.04 LTS Operating System. If you are not already logged in as su, installer will ask you the root password. After completion of the installation you can use the package on your system.

Now we will see the commands for uninstalling the gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign from Ubuntu 20.04 LTS. For uninstalling this package you can easily use the apt command and remove the package from Linux Operating System.

To remove the gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign following command is used:

Following command is used to remove the gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign package along with its dependencies:

This will remove gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign and all its dependent packages which is no longer needed in the system.

Completely removing gsl-bin Architecture: amd64 Version: 2.5+dfsg-6build1 Multi-Arch: foreign with all configuration files:

Following command should be used with care as it deletes all the configuration files and data:

[3]
Edit
Query
Report
Zaheera Janardhan
Industrial-Organizational Psychologist
Answer # 2 #
  • Download gsl-latest.tar.gz from the GSL ftp site and unzip it anywhere (e.g. /Downloads)
  • Open the unzipped gsl folder in Terminal (e.g. cd ~/Downloads/gsl-2.4.
  • Run sudo ./configure && make && make install.
[3]
Edit
Query
Report
Guimalan Mehak
BUNCH MAKER MACHINE
Answer # 3 #

Table of Contents

The GNU Scientific library (GSL) is a powerful C/C++ numerical library.

This guide assumes you already have a working C/C++ compiler - check by entering gcc --version in Terminal. OSX's default Clang compiler is fine, otherwise this page describes how to install gcc 4.9.

Apparently GSL can be installed through Homebrew via

though installing it manually is just as simple, which we now describe.

If the above gives a "permission denied" error, instead try

You'll now be able to include GSL into your code from anywhere.

You'll now be able to include GSL into your code from anywhere.

In the ARCUS terminal, download GSL anywhere

and unzip it

then open the new folder e.g.

To install without admin permissions, we'll keep the GSL files in a folder called gsl .

Note some newer versions off gcc (e.g. 8) seem incompatible. Use an older version (e.g. gcc/5.3.0) and first call

Replace YOURUSERNAME below with your ARCUS-B username (e.g. abcd1234) and run

We'll need to remember this location when compiling

Compiling GSL with our code is easy; we simply add library flags -lm -lgsl -lgslcblas to our calls to gcc.

For example, we'd adapt the QuEST makefile to include

Exactly as above for OSX.

Before compiling on ARCUS-B, we must extend LD_LIBRARY to include our gsl folder (replace YOURUSERNAME below)

This need only be done once each time we SSH into ARCUS.

Our compilation must additionally include the -lm -lgsl -lgslcblas libraries and flags -I/data/oums-quantopo/YOURUSERNAME/gsl/include and -L/data/oums-quantopo/YOURUSERNAME/gsl/lib.

For example, we'd modify the QuEST makefile to include

and just after that, insert

and modify the rules list

and finally the build commands

See a complete example of my QuEST & gsl makefile here.

The many different GSL functions are available in different source files.

For example, to use the matrix, linear equation solver, and matrix multiplication functionalities, respectively include

View available functions and their necessary header files can be found here.

Sometimes GSL is so powerful, it's confusing to figure out how to do some simple things. So here are some examples

Matrices are dynamic objects, indexed from 0, which must be allocated before, and freed after, their use.

For a vector, replace matrix above with vector.

GSL's matrix operations come under 'Basic Linear Algebra Subprograms' (BLAS), listed here

To multiply matrices matrA and matrB and store the result in matrC (all of which must be previously allocated by gsl_matrix_alloc), call:

In the name gsl_blas_dgemm, the d refers to double-precision matrices, and the final m refers to matrix. The other arguments are explained here.

To multiply a matrix matrA and a vector vecB and store the result in vecC (previously allocated by gsl_matrix_alloc and gsl_vector_alloc), call:

Linear algebra operations are provided by

Here's how to solve A x = b (or matrA vecX = vecB) for x by LU decomposition, which involves creating an intermediate permutation structure

By default, a numerical error (e.g. attempting to invert a non-invertible matrix) will cause an error message and execution to stop. To instead detect and handle numerical errors, include

and call

[1]
Edit
Query
Report
Keth pfyeplv Koglu
FINISH MACHINE TENDER