gosl

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2023 License: BSD-3-Clause

README

Gosl – Go scientific library

GoDoc

Gosl is a library written in Go (golang) to develop high-performance scientific computing with ease. The library tries to be as general and easy as possible. Gosl considers the use of both Go concurrency routines and parallel computing using the message passing interface. Gosl has several modules (sub-libraries/sub-packages) for a variety of tasks in scientific computing, image analysis, and data post-processing. For example, it includes high-performant linear algebra functions (e.g. wrapping MKL/OpenBLAS/LAPACK/SuiteSparse/UMFPACK etc.), fast Fourier transform algorithms (e.g. wrapping FFTW), functions and structures for geometry calculations, random numbers generation and probability distributions, optimisation algorithms, plotting and visualisation using the VTK, and much more. Gosl has also solvers to (stiff or not) ordinary differential equations and several tools for mesh generation to assist on the development of finite element solvers.

See the documentation for more details (e.g. how to call functions and use structures).

Summary

Gosl includes the following subpackages:

  1. chk – Check code and unit test tools
  2. io – Input/output, read/write files, and print commands
  3. utl – Utilities. Lists. Dictionaries. Simple Numerics
  4. plt – Plotting and drawing (png and eps)
  5. mpi – Message Passing Interface for parallel computing
  6. la – Linear Algebra and efficient sparse solvers
  7. la/mkl – Lower level linear algebra using Intel MKL
  8. la/oblas – Lower level linear algebra using OpenBLAS
  9. fdm – Simple finite differences method
  10. num – Fundamental numerical methods such as root solvers, non-linear solvers, numerical derivatives and quadrature
  11. fun – Special functions, DFT, FFT, Bessel, elliptical integrals, orthogonal polynomials, interpolators
  12. fun/dbf – Database of functions of a scalar and a vector like f(t,{x}) (e.g. time-space)
  13. fun/fftw – Go wrapper to FFTW
  14. gm – Geometry algorithms and structures
  15. gm/msh – Mesh structures and interpolation functions for FEA, including quadrature over polyhedra
  16. gm/tri – Mesh generation: triangles and Delaunay triangulation (wrapping Triangle)
  17. gm/rw – Mesh generation: read/write routines
  18. graph – Graph theory structures and algorithms
  19. ode – Ordinary differential equations (stiff/non-stiff RK methods)
  20. opt – Solvers for optimisation problems (e.g. interior point method)
  21. rnd – Random numbers and probability distributions
  22. rnd/dsfmt – Go wrapper to dSIMD-oriented Fast Mersenne Twister
  23. rnd/sfmt – Go wrapper to SIMD-oriented Fast Mersenne Twister
  24. tsr – Tensor algebra and definitions for continuum mechanics
  25. vtk – 3D Visualisation with the VTK tool kit
  26. img – Image and machine learning algorithms for images
  27. img/ocv – Go wrapper to OpenCV

Examples

See the output of examples here

Installation

Since Gosl needs some other C and Fortran codes, not all sub-packages can be directly installed using go get .... Nonetheless, Gosl is pretty easy to install! See links below:

  1. Ubuntu
  2. Windows
  3. macOS

The following subpackages are available on Linux only at the moment: mpi, la/mkl, and vtk. The following subpackages are not available for Windows at the moment: gm/tri, rnd/sfmt, and rnd/dsfmt. Help to compile these packages in all platforms is much welcome and appreciated.

About the filenames

  1. t_something_test.go is a unit test. We have several of them! Some usage information can be learned from these files.
  2. t_something_main.go is a test with a main function to be run with go run ... or mpirun -np ? go run ... (replace ? with the number of cpus). There very few of these files.
  3. t_b_something_test.go is a benchmark test. There a few of them. Run benchmarks with go test -run=XXX -bench=.

Design strategies

Here, we call structure any user-defined type. These are simply Go types defined as struct. One may think of these structures as classes. Gosl has several global functions as well and tries to avoid complicated constructions.

An allocated structure (instance) is called an object and functions attached to this object are called methods. In Gosl, the variable holding the pointer to an object is always named o (lower case "o"). This variable is similar to the self or this keywords in other languages (Python, C++, respectively).

Functions that allocate a pointer to a structure are prefixed with New; for instance: NewIsoSurf. Some structures require an explicit call to another function to release allocated memory. Be aware of this requirement! In this case, the function is named Free and appears in a few sub-packages that use CGO. Also, some objects may need to be initialised before use. In this case, functions named Init have to be called.

The directories corresponding to each package has a README.md file that should help with understanding the library. Also, there are links to godoc.org where all functions, structures, and variables are well explained.

Bibliography

Gosl is partly included in the following works:

  1. Pedroso DM (2017) FORM reliability analysis using a parallel evolutionary algorithm, Structural Safety 65:84-99 http://dx.doi.org/10.1016/j.strusafe.2017.01.001
  2. Pedroso DM, Zhang YP, Ehlers W (2017) Solution of liquid-gas-solid coupled equations for porous media considering dynamics and hysteretic retention behaviour, Journal of Engineering Mechanics 04017021 http://dx.doi.org/10.1061/(ASCE)EM.1943-7889.0001208
  3. Pedroso DM (2015) A solution to transient seepage in unsaturated porous media. Computer Methods in Applied Mechanics and Engineering, 285:791-816 http://dx.doi.org/10.1016/j.cma.2014.12.009
  4. Pedroso DM (2015) A consistent u-p formulation for porous media with hysteresis. Int. Journal for Numerical Methods in Engineering, 101(8):606-634 http://dx.doi.org/10.1002/nme.4808

Authors and license

See the AUTHORS file.

Unless otherwise noted, the Gosl source files are distributed under the BSD-style license found in the LICENSE file.

Directories

Path Synopsis
Package chk contains functions for checking and testing computations
Package chk contains functions for checking and testing computations
package fdm implements functions and structures to assist on the development of finite difference solutions of problems involving partial differential equations
package fdm implements functions and structures to assist on the development of finite difference solutions of problems involving partial differential equations
fun
Package fun (functions) implements special functions such as elliptical, orthogonal polynomials, Bessel, discrete Fourier transform, polynomial interpolators, and more.
Package fun (functions) implements special functions such as elliptical, orthogonal polynomials, Bessel, discrete Fourier transform, polynomial interpolators, and more.
dbf
Package dbf implements a database of f(t,{x}) functions (e.g.
Package dbf implements a database of f(t,{x}) functions (e.g.
fftw
Package fftw wraps the FFTW library to perform Fourier Transforms using the "fast" method by Cooley and Tukey
Package fftw wraps the FFTW library to perform Fourier Transforms using the "fast" method by Cooley and Tukey
gm
gm (geometry and meshes) implements auxiliary functions for handling geometry and mesh structures
gm (geometry and meshes) implements auxiliary functions for handling geometry and mesh structures
msh
package msh defines mesh data structures and implements interpolation functions for finite element analyses (FEA)
package msh defines mesh data structures and implements interpolation functions for finite element analyses (FEA)
rw
package rw implements reader and writers for geometry files such as the STEP file format
package rw implements reader and writers for geometry files such as the STEP file format
tri
package tri wraps Triangle to perform mesh generation a Delaunay triangulation
package tri wraps Triangle to perform mesh generation a Delaunay triangulation
package graph implements solvers based on Graph theory
package graph implements solvers based on Graph theory
img
package img provides tools to manipulate images including some machine learning techniques (e.g.
package img provides tools to manipulate images including some machine learning techniques (e.g.
ocv
package ocv connects with the OpenCV library for image analyses and machine learning, in particular for computer vision algorithms.
package ocv connects with the OpenCV library for image analyses and machine learning, in particular for computer vision algorithms.
Package io (input/output) implements auxiliary functions for printing, parsing, handling files, directories, etc.
Package io (input/output) implements auxiliary functions for printing, parsing, handling files, directories, etc.
la
Package la implements routines and structures for linear algebra with matrices and vectors in dense and sparse formats (including complex)
Package la implements routines and structures for linear algebra with matrices and vectors in dense and sparse formats (including complex)
mkl
package mkl implements lower level linear algebra using Intel MKL for max efficiency
package mkl implements lower level linear algebra using Intel MKL for max efficiency
oblas
package oblas implements lower level linear algebra using OpenBLAS for max efficiency
package oblas implements lower level linear algebra using OpenBLAS for max efficiency
package mpi wraps the Message Passing Interface for parallel computations
package mpi wraps the Message Passing Interface for parallel computations
package num implements fundamental numerical methods such as numerical derivative and quadrature, root finding solvers (Brent's and Newton's methods), among others.
package num implements fundamental numerical methods such as numerical derivative and quadrature, root finding solvers (Brent's and Newton's methods), among others.
package ode implements solvers for ordinary differential equations, such as the ones based on the Runge-Kutta method; e.g.
package ode implements solvers for ordinary differential equations, such as the ones based on the Runge-Kutta method; e.g.
package opt implements routines for solving optimisation problems
package opt implements routines for solving optimisation problems
plt contains functions for plotting, drawing in 2D or 3D, and generationg PNG and EPS files
plt contains functions for plotting, drawing in 2D or 3D, and generationg PNG and EPS files
rnd
package rnd implements random numbers generators (wrapping the standard functions or the Mersenne Twister library).
package rnd implements random numbers generators (wrapping the standard functions or the Mersenne Twister library).
dsfmt
package dsfmt wraps the dSFMT Double precision SIMD-oriented Fast Mersenne Twister
package dsfmt wraps the dSFMT Double precision SIMD-oriented Fast Mersenne Twister
sfmt
package sfmt wraps the SFMT SIMD-oriented Fast Mersenne Twister
package sfmt wraps the SFMT SIMD-oriented Fast Mersenne Twister
tsr implements routines to conduct tensor operations and solve problems in Continuum Mechanics
tsr implements routines to conduct tensor operations and solve problems in Continuum Mechanics
package utl implements functions for simplifying calculations and allocation of structures such as slices and slices of slices.
package utl implements functions for simplifying calculations and allocation of structures such as slices and slices of slices.
package vtk wraps the visualisation tool kit (VTK) for drawing 3D surfaces (scalar fields, vector fields, etc.)
package vtk wraps the visualisation tool kit (VTK) for drawing 3D surfaces (scalar fields, vector fields, etc.)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL