Print Friendly and PDF

GoldSim External Element and the GNU Scientific Library

Nick Martin -

The GNU Scientific Library (GSL) “is a collection of routines for numerical computing. The routines have been written from scratch in C, and present a modern Applications Programming Interface (API) for C programmers, allowing wrappers to be written for very high level languages. The source code is distributed under the GNU General Public License. (Galassi, et al., 2015)”

The library covers a wide range of topics in numerical computing. Routines are available covering the subject matter areas listed below. GSL provides the building blocks for a wide range of scientific and engineering calculations.

 

GSL Subject Matter Coverage

Complex Numbers Roots of Polynomials Special Functions Vectors and Matrices
Permutations Combinations Sorting BLAS Support
Linear Algebra CBLAS Library Fast Fourier Transforms Eigensystems
Random Numbers Quadrature Random Distributions Quasi-Random Sequences
Histograms Statistics Monte Carlo Integration N-Tuples
Differential Equations Simulated Annealing Numerical Differentiation Interpolation
Series Acceleration Chebyshev Approximations Root-Finding Discrete Hankel Transforms
Least-Squares Fitting Minimization IEEE Floating-Point Physical Constants
Basis Splines Wavelets    

 

Historically, it has been hard to find a version of the GSL that is available in a format prepared for Microsoft Windows operating systems and for compilation using Microsoft Visual Studio. GoldSim is a Windows operating system only, desktop computer program and so it can be difficult to use GSL with GoldSim because of the difficulty in compiling the GSL libraries into a format that can be easily accessed from a native Windows desktop program like GoldSim.

GSL is always available under the GNU General Public License (GPL) and is primarily targeted for use on Linux/unix and/or with the GNU gcc compiler suite. In the last several years, a port of the GSL has been made available which contains a collection of makefiles that can be converted to Visual Studio solutions using the CMake utility. The result is a version of GSL that can easily be used from GoldSim via a custom dynamic-link library (DLL) and the GoldSim External element.

This version of GSL is included in the archive available from the link at the bottom of the page. This source code package can also be obtained by accessing the GSL source code from https://github.com/ampl/gsl. The CMake utility then needs to be used to create Visual Studio solution files from the makefiles distributed with this GSL source code repository.

The primary use mechanism for GSL and GoldSim would be through the External element which provides a coupling mechanism for separate program modules (written in C, C++, FORTRAN or other compatible programming languages) to the main GoldSim algorithms. To use or call GSL routines from GoldSim via the External element, a DLL needs to be created and compiled which links to and uses the GSL routines. The External element then loads the DLL and provides the interface to pass values between GoldSim and custom GSL routines which are either incorporated into the DLL or accessed via the DLL.

The link below provides access to a zip archive which contains:

  • HOWTO document, "GoldSim External Element and GSL DLLs: HOW TO USE THE GNU SCIENTIFIC LIBRARY (GSL) WITH GOLDSIM"
  • Source code for GSL and for example DLLs for use with the GoldSim External element
  • Instructions for compiling static GSL libraries using CMake and Visual Studio 2015 and then linking these libraries to custom C++ code
  • Two example GoldSim models demonstrating the creation of a custom DLLs which use GSL routines

 

Download the HOWTO document and associated source code: 

GoldSim Model Library

 

 

Tags:

  • GSL
  • External Element
  • C++ DLL
Have more questions? Submit a request

Comments