Gonum Build Status Build status GoDoc Go Report Card stability-unstable


The core packages of the Gonum suite are written in pure Go with some assembly. Installation is done using go get.

go get -u

Supported Go versions

Gonum supports and tests using the gc compiler on the two most recent Go releases on Linux (386, amd64 and arm64), macOS and Windows (both on amd64).

Release schedule

The Gonum modules are released on a six-month release schedule, aligned with the Go releases. i.e.: when Go-1.x is released, Gonum-v0.n.0 is released around the same time. Six months after, Go-1.x+1 is released, and Gonum-v0.n+1.0 as well.

The release schedule, based on the current Go release schedule is thus:

  • Gonum-v0.n.0: February
  • Gonum-v0.n+1.0: August

Build tags

The Gonum packages use a variety of build tags to set non-standard build conditions. Building Gonum applications will work without knowing how to use these tags, but they can be used during testing and to control the use of assembly and CGO code.

The current list of non-internal tags is as follows:

  • appengine — do not use assembly or unsafe
  • safe — synonym for appengine
  • bounds — use bounds checks even in internal calls
  • cblas — use CGO BLAS implementation in tests (only in mat package)
  • noasm — do not use assembly implementations
  • tomita — use Tomita, Tanaka, Takahashi pivot choice for maximimal clique calculation, otherwise use random pivot (only in topo package)

Issues TODOs

If you find any bugs, feel free to file an issue on the github issue tracker. Discussions on API changes, added features, code review, or similar requests are preferred on the gonum-dev Google Group.!forum/gonum-dev


Original code is licensed under the Gonum License found in the LICENSE file. Portions of the code are subject to the additional licenses found in THIRD_PARTY_LICENSES. All third party code is licensed either under a BSD or MIT license.

Code in graph/formats/dot is dual licensed Public Domain Dedication and Gonum License, and users are free to choose the license which suits their needs for this code.

Expand ▾ Collapse ▴



Gonum is a set of packages designed to make writing numerical and scientific algorithms productive, performant, and scalable.

Gonum contains libraries for matrices and linear algebra; statistics, probability distributions, and sampling; tools for function differentiation, integration, and optimization; network creation and analysis; and more.



This section is empty.


This section is empty.


func Version

func Version() (version, sum string)

Version returns the version of Gonum and its checksum. The returned values are only valid in binaries built with module support.

If a replace directive exists in the Gonum go.mod, the replace will be reported in the version in the following format:

"version=>[replace-path] [replace-version]"

and the replace sum will be returned in place of the original sum.

The exact version format returned by Version may change in future.


This section is empty.

Source Files


Path Synopsis
blas Package blas provides interfaces for the BLAS linear algebra standard.
blas/blas32 Package blas32 provides a simple interface to the float32 BLAS API.
blas/blas64 Package blas64 provides a simple interface to the float64 BLAS API.
blas/cblas128 Package cblas128 provides a simple interface to the complex128 BLAS API.
blas/cblas64 Package cblas64 provides a simple interface to the complex64 BLAS API.
blas/gonum Package gonum is a Go implementation of the BLAS API.
blas/testblas Package testblas provides tests for blas implementations.
blas/testblas/benchautogen Script for automatic code generation of the benchmark routines.
cmplxs Package cmplxs provides a set of helper routines for dealing with slices of complex128.
cmplxs/cscalar Package cscalar provides a set of helper routines for dealing with complex128 values.
diff/fd Package fd provides functions to approximate derivatives using finite differences.
dsp/fourier Package fourier provides functions to perform Discrete Fourier Transforms.
dsp/fourier/internal/fftpack Package fftpack implements Discrete Fourier Transform functions ported from the Fortran implementation of FFTPACK.
dsp/window Package window provides a set of functions to perform the transformation of sequence by different window functions.
floats Package floats provides a set of helper routines for dealing with slices of float64.
floats/scalar Package scalar provides a set of helper routines for dealing with float64 values.
graph Package graph defines graph interfaces.
graph/community Package community provides graph community detection functions.
graph/encoding Package encoding provides a common graph encoding API.
graph/encoding/digraph6 Package digraph6 implements graphs specified by digraph6 strings.
graph/encoding/dot Package dot implements GraphViz DOT marshaling and unmarshaling of graphs.
graph/encoding/graph6 Package graph6 implements graphs specified by graph6 strings.
graph/encoding/graphql Package graphql implements JSON marshaling and unmarshaling of graph as used by GraphQL
graph/flow Package flow provides control flow analysis functions.
graph/formats/cytoscapejs Package cytoscapejs implements marshaling and unmarshaling of Cytoscape.js JSON documents.
graph/formats/dot Package dot implements a parser for Graphviz DOT files.
graph/formats/dot/ast Package ast declares the types used to represent abstract syntax trees of Graphviz DOT graphs.
graph/formats/dot/internal/astx Package astx implements utility functions for generating abstract syntax trees of Graphviz DOT graphs.
graph/formats/dot/internal/errors Package error provides generated internal error functions for DOT parsing.
graph/formats/dot/internal/lexer Package lexer provides generated internal lexer functions for DOT parsing.
graph/formats/dot/internal/parser Package parser provides generated internal parsing functions for DOT parsing.
graph/formats/dot/internal/token Package token provides generated internal tokenizing functions for DOT parsing.
graph/formats/dot/internal/util Package util provides generated internal utility functions for DOT parsing.
graph/formats/gexf12 Package gexf12 implements marshaling and unmarshaling of GEXF1.2 documents.
graph/formats/sigmajs Package sigmajs implements marshaling and unmarshaling of Sigma.js JSON documents.
graph/graphs/gen Package gen provides random graph generation functions.
graph/internal/linear Package linear provides common linear data structures.
graph/internal/ordered Package ordered provides common sort ordering types.
graph/internal/set Package set provides integer and graph.Node sets.
graph/internal/uid Package uid implements unique ID provision for graphs.
graph/iterator Package iterator provides node, edge and line iterators.
graph/layout Package layout defines functions for performing graph layout.
graph/multi Package multi provides a suite of multigraph implementations satisfying the gonum/graph interfaces.
graph/network Package network provides network analysis functions.
graph/path Package path provides graph path finding functions.
graph/path/dynamic Package dynamic provides incremental heuristic graph path finding functions.
graph/path/internal/testgraphs Package testsgraphs provides a number of graphs used for testing routines in the path and path/dynamic packages.
graph/product Package product implements graph product functions.
graph/simple Package simple provides a suite of simple graph implementations satisfying the gonum/graph interfaces.
graph/spectral Package spectral provides graph spectral analysis functions.
graph/testgraph Package testgraph provides a set of testing helper functions that test Gonum graph interface implementations.
graph/topo Package topo provides graph topology analysis functions.
graph/traverse Package traverse provides basic graph traversal primitives.
integrate Package integrate provides functions to compute an integral given a specific list of evaluations.
integrate/quad Package quad provides numerical evaluation of definite integrals of single-variable functions.
integrate/testquad Package testquad provides integrals for testing quadrature algorithms.
internal/asm/c128 Package c128 provides complex128 vector primitives.
internal/asm/c64 Package c64 provides complex64 vector primitives.
internal/asm/f32 Package f32 provides float32 vector primitives.
internal/asm/f64 Package f64 provides float64 vector primitives.
internal/cmplx64 Package cmplx64 provides complex64 versions of standard library math/cmplx package routines used by gonum/blas.
internal/math32 Package math32 provides float32 versions of standard library math package routines used by gonum/blas/native.
internal/testrand Package testrand provides random generation and flags for testing.
interp Package interp implements 1-dimensional algorithms for interpolating values.
lapack Package lapack provides interfaces for the LAPACK linear algebra standard.
lapack/gonum Package gonum is a pure-go implementation of the LAPACK API.
lapack/lapack64 Package lapack64 provides a set of convenient wrapper functions for LAPACK calls, as specified in the netlib standard (
lapack/testlapack Package testlapack implements a set of testing routines for Lapack functions.
mat Package mat provides implementations of float64 and complex128 matrix structures and linear algebra operations on them.
mathext Package mathext implements special math functions not implemented by the Go standard library.
mathext/internal/amos Package amos implements functions originally in the Netlib code by Donald Amos.
mathext/internal/cephes Package cephes implements functions originally in the Netlib code by Stephen Mosher.
mathext/internal/gonum Package gonum contains functions implemented by the gonum team.
mathext/prng Package prng provides random source PRNG implementations.
num/dual Package dual provides the dual numeric type and functions.
num/dualcmplx Package dualcmplx provides the anti-commutative dual complex numeric type and functions.
num/dualquat Package dualquat provides the dual quaternion numeric type and functions.
num/hyperdual Package hyperdual provides the hyperdual numeric type and functions.
num/quat Package quat provides the quaternion numeric type and functions.
optimize Package optimize implements algorithms for finding the optimum value of functions.
optimize/convex/lp Package lp implements routines to solve linear programming problems.
optimize/functions Package functions provides objective functions for testing optimization algorithms.
spatial/barneshut Package barneshut provides routines for calculating n-body force approximations using the Barnes-Hut algorithm.
spatial/kdtree Package kdtree implements a k-d tree.
spatial/r1 Package r1 provides 1D vectors and intervals and operations on them.
spatial/r2 Package r2 provides 2D vectors and boxes and operations on them.
spatial/r3 Package r3 provides 3D vectors and boxes and operations on them.
spatial/vptree Package vptree implements a vantage point tree.
stat Package stat provides generalized statistical functions.
stat/card Package card provides cardinality estimation functions.
stat/combin Package combin implements routines involving combinatorics (permutations, combinations, etc.).
stat/distmat Package distmat provides probability distributions over matrices.
stat/distmv Package distmv provides multivariate random distribution types.
stat/distuv Package distuv provides univariate random distribution types.
stat/mds Package mds provides multidimensional scaling functions.
stat/samplemv Package samplemv implements advanced sampling routines from explicit and implicit probability distributions.
stat/sampleuv Package sampleuv implements advanced sampling routines from explicit and implicit probability distributions.
stat/spatial Package spatial provides spatial statistical functions.
unit Package unit provides a set of types and constants that facilitate the use of the International System of Units (SI).
unit/constant Package constant provides fundamental constants satisfying unit.Uniter.