Gonum is a set of numeric libraries for the Go programming language. It contains libraries for matrices, statistics, optimization, and more

Gonum

Build status Build Status Build status codecov.io coveralls.io go.dev reference GoDoc Go Report Card stability-unstable

Installation

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

go get -u gonum.org/v1/gonum/...

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:

  • safe — do not use assembly or unsafe
  • bounds — use bounds checks even in internal calls
  • cblas — use CGO gonum.org/v1/netlib/blas/netlib 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.

https://groups.google.com/forum/#!forum/gonum-dev

License

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.

The W3C test suites in graph/formats/rdf are distributed under both the W3C Test Suite License and the W3C 3-clause BSD License.

Owner
Consistent, composable, and comprehensible scientific code
null
Comments
  • fourier: new package for fourier analysis and related functions

    fourier: new package for fourier analysis and related functions

    Please take a look.

    So far I have only added the backing code. I want to add CFFT[IFB] and then I will dismantle some of the array.go support (remove 1-based indexing and the linear support types). It makes sense to add the API in this PR, so suggestions welcome here.

  • meta-issue: document deprecation of all old gonum/xyz repos

    meta-issue: document deprecation of all old gonum/xyz repos

    (putting it there, feel free to redirect to the best place)

    we should clearly put on all the old gonum/xyz repositories' README.md that these repos are deprecated and that issues, PRs should be redirected at gonum/gonum.

    I don't think we clearly communicated this.

  • optimize: completely overhaul Global

    optimize: completely overhaul Global

    The previous implementation of Global was a minefield for incorrectly implementing global optimization methods. It was very difficult to correctly implement methods (both of the provided methods were incorrect), and the resulting code is very ugly. This commit switches to use channels to communicate, allowing a more clear ordering of concurrent code. This also enables better shutdown of methods.

    In addition to the main fix of Global, this refactors the two Global methods to use the updated interface, and makes some small improvements that were previously not possible. In addition, there are some small cleanups of Local to better match between the two calls.

    If anyone has been curious about what is meant by 'Don't communicate by sharing memory, share memory by communicating' this is it, and why.

  • stat/spatial: new package for spatial statistic measures

    stat/spatial: new package for spatial statistic measures

    @btracey @vladimir-ch @Armadilloa16 @ReubenBuck Please take a look.

    This is commit one of ~~two~~ three. The ~~second~~ final commit will add element-wise weights, after the API is otherwise settled.

    Possible considerations are adding a reset method to allow data/locality reuse.

  • floats: add SameScalars to compare two float64 values with NaN == NaN.

    floats: add SameScalars to compare two float64 values with NaN == NaN.

    What

    floats/floats.go has a function

    // Same returns true if the input slices have the same length and all elements
    // have the same value with NaN treated as the same.
    func Same(s, t []float64) bool {
    ...}
    

    I would like to add there a function SameScalars which does the same for scalar inputs:

    // SameScalars returns true if the inputs have the same value with NaN treated as the same.
    func SameScalars(a, b float64) bool {
    	return a == b || (math.IsNaN(a) && math.IsNaN(b))
    }
    

    Rationale

    Such a function will be useful for unit testing functions which are expected to return NaNs for some inputs.

    Updated proposal

    Rename Same to AllSame (breaks code) and call the new function Same.

  • unit: Intermittent test failure in TestFormat

    unit: Intermittent test failure in TestFormat

    I seem to be getting an occasional test failure in TestFormat (and travis-ci does as well):

    --- FAIL: TestFormat (0.00 seconds) unit_test.go:44: Format "%#v": got: "&unit.Unit{dimensions:unit.Dimensions{6:-1, 4:2}, formatted:"", value:6.62606957e-34}" expected: "&unit.Unit{dimensions:unit.Dimensions{4:2, 6:-1}, formatted:"", value:6.62606957e-34}" FAIL

    go test -race doesn't find anything wrong.

  • stat: ROC signature

    stat: ROC signature

    I came up with what I think is an improvement to the ROC function, in which the cutoffs are defined explicitly instead of the number of cutoffs n. This allows for unequally-spaced cutoffs, allows for all cutoffs to be used more naturally, and simplifies the code itself.

    Is this a good idea -- should I put a PR in for it, @sbinet @kortschak ?

    Also, I was thinking maybe ROC should output an error as well, instead of all the panic statements? Or is it appropriate that it panic?

    What I did is here, in case you wanted to look at the specifics of what I am suggesting: https://github.com/Armadilloa16/stat/tree/roc

  • floats: adding AreUnique

    floats: adding AreUnique

    While discussing a PR (https://github.com/gonum/floats/pull/61) on the floats package before the merger, it was suggested that an AreUnique function would be useful.

  • lapack: add Dorgr2 routine

    lapack: add Dorgr2 routine

    Disclaimer: Only tested with square matrices since that's all I seem to be able to generate with constructQK helper.

    ARE issue: https://github.com/gonum/gonum/issues/1651

  • Interp

    Interp

    interp: This change modifies Gonum by adding a new interp/ package with interpolation algorithms.

    I implemented three basic 1D interpolators so far:

    • constant
    • piecewise linear
    • piecewise constant

    Submitting a PR now to start the review process and adjust the code design & style to the project requirements, before I go down some rabbit hole ;-)

    Cheers, Roman

  • mat: add Doer interface and implementations

    mat: add Doer interface and implementations

    This is a proposal for an approach to optimising sparse or sparsish matrix accesses raised in https://github.com/gonum/gonum/pull/124#discussion_r126201816

    ~~Only https://github.com/gonum/gonum/commit/2eb65a280581fdb47fa2714f84b793f652ccbb58 is relevant to this PR and I'll revise the history of the PR when #95 is merged.~~

    Depends #95.

  • graph/path: fix yen k-shortest path with root cycles

    graph/path: fix yen k-shortest path with root cycles

    Previously the code was not removing nodes on the root of the search path, resulting in searches that could re-enter previously searched nodes. In addition to this, the logic for making edges was incorrectly making both directions for digraphs and only one direction for undirected graphs.

    Finally, the range of nodes to include in the spur-node set was off-by-one. This is now clarified by including the comment from the wiki article since the pseudo-code is less clear than the English due to choice of range indexing convention.

    Please take a look.

    Fixes #1778

  • Renovate Bot can not lookup new versions for gonum

    Renovate Bot can not lookup new versions for gonum

    What are you trying to do?

    When running renovate bot on my project, it fails to resolve the gonum dependency:

    image

    Does anyone have any suggestions, why this is the case? I do not have this problem for any other dependency.

  • `stat.Quantile` returns wrong value when dataset is even size

    `stat.Quantile` returns wrong value when dataset is even size

    What are you trying to do?

    I'm trying to get median value when I request even size of dataset to stat.Quantile

    What did you do?

    func main() {
    	xs := []float64{2, 3, 5, 9}
    	median := stat.Quantile(0.5, stat.Empirical, xs, nil)
    
    	fmt.Println(median)
    }
    

    https://go.dev/play/p/8b6vDMunna8

    What did you expect to happen?

    I expect return value 4

    What actually happened?

    its returns 3

    What version of Go and Gonum are you using?

    1.19

    Does this issue reproduce with the current master?

    Yes

  • Add noise generation functionality

    Add noise generation functionality

    What are you trying to do?

    Create simplex noise in 2D.

    What did you try?

    Created my own package here: https://github.com/soypat/decaffeinator/blob/main/tagalong/pkg-noise/simplex.go

    How does Gonum not allow you to achieve your goal?

    I was not able to find noise generation in gonum.

    Are you able to help contribute the feature?

    Yes, see above link.

A well tested and comprehensive Golang statistics library package with no dependencies.

Stats - Golang Statistics Package A well tested and comprehensive Golang statistics library / package / module with no dependencies. If you have any s

Dec 26, 2022
GoStats is a go library for math statistics mostly used in ML domains, it covers most of the statistical measures functions.

GoStats GoStats is an Open Source Go library for math statistics mostly used in Machine Learning domains, it covers most of the Statistical measures f

Nov 10, 2022
2D triangulation library. Allows translating lines and polygons (both based on points) to the language of GPUs.
2D triangulation library. Allows translating lines and polygons (both based on points) to the language of GPUs.

triangolatte 2D triangulation library. Allows translating lines and polygons (both based on points) to the language of GPUs. Features normal and miter

Dec 23, 2022
Package goraph implements graph data structure and algorithms.
Package goraph implements graph data structure and algorithms.

goraph Package goraph implements graph data structure and algorithms. go get -v gopkg.in/gyuho/goraph.v2; I have tutorials and visualizations of grap

Dec 20, 2022
Types and utilities for working with 2d geometry in Golang

orb Package orb defines a set of types for working with 2d geo and planar/projected geometric data in Golang. There are a set of sub-packages that use

Dec 28, 2022
Sparse matrix formats for linear algebra supporting scientific and machine learning applications

Sparse matrix formats Implementations of selected sparse matrix formats for linear algebra supporting scientific and machine learning applications. Co

Jan 8, 2023
:wink: :cyclone: :strawberry: TextRank implementation in Golang with extendable features (summarization, phrase extraction) and multithreading (goroutine) support (Go 1.8, 1.9, 1.10)
:wink: :cyclone: :strawberry: TextRank implementation in Golang with extendable features (summarization, phrase extraction) and multithreading (goroutine) support (Go 1.8, 1.9, 1.10)

TextRank on Go This source code is an implementation of textrank algorithm, under MIT licence. The minimum requred Go version is 1.8. MOTIVATION If th

Dec 18, 2022
Polygol - Boolean polygon clipping/overlay operations (union, intersection, difference, xor) on Polygons and MultiPolygons
Polygol - Boolean polygon clipping/overlay operations (union, intersection, difference, xor) on Polygons and MultiPolygons

polygol Boolean polygon clipping/overlay operations (union, intersection, differ

Jan 8, 2023
Gonum is a set of numeric libraries for the Go programming language. It contains libraries for matrices, statistics, optimization, and more

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

Dec 29, 2022
Evolutionary optimization library for Go (genetic algorithm, partical swarm optimization, differential evolution)
Evolutionary optimization library for Go (genetic algorithm, partical swarm optimization, differential evolution)

eaopt is an evolutionary optimization library Table of Contents Changelog Example Background Features Usage General advice Genetic algorithms Overview

Dec 30, 2022
matex - extension of gonum.mat

matex - extension of gonum.mat

Dec 25, 2021
Convert Arabic numeric amounts to Chinese character

将阿拉伯数字金额转换为汉字的形式 Convert Arabic numeric amounts to Chinese character form. 安装使用 Golang 版本大于等于1.16 go get -u github.com/aliliin/rmb-character import (

Sep 9, 2021
Parsing of numeric ranges from string

expand-range Parsing of numeric ranges from string. Convert "1,3-5" into [1,3,4,5]. Installation go get -u github.com/n0madic/expand-range Usage Impor

Nov 28, 2021
Floppa programming language inspired by the brainf*ck programming language. Created just for fun and you can convert your brainf*ck code to floppa code.

Floppa Programming Language Created just for fun. But if you want to contribute, why not? Floppa p.l. inspired by the brainf*ck programming language.

Oct 20, 2022
T# Programming Language. Something like Porth, Forth but written in Go. Stack-oriented programming language.

The T# Programming Language WARNING! THIS LANGUAGE IS A WORK IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! Something like Forth a

Jun 29, 2022
Yayx programming language is begginer friendly programming language.
Yayx programming language is begginer friendly programming language.

Yayx Yayx programming language is begginer friendly programming language. What have yayx: Easy syntax Dynamic types Can be compiled to outhers program

Dec 27, 2021
Yayx programming language is begginer friendly programming language.

Yayx Yayx programming language is begginer friendly programming language. What have yayx: Easy syntax Dynamic types Can be compiled to outhers program

May 20, 2022
Genetic Algorithm and Particle Swarm Optimization

evoli Genetic Algorithm and Particle Swarm Optimization written in Go Example Problem Given f(x,y) = cos(x^2 * y^2) * 1/(x^2 * y^2 + 1) Find (x,y) suc

Dec 22, 2022
This repository contains a set of tools to help you implement IndieAuth, both server and client, in Go.

This repository contains a set of tools to help you implement IndieAuth, both server and client, in Go.

Nov 26, 2022
A cli that shows a GitHub-like language usage statistics bar.
A cli that shows a GitHub-like language usage statistics bar.

barley A cli that shows a GitHub-like language usage statistics bar. barley analyses the programming languages used in a directory and creates a used

Jan 8, 2022