vectormath alternatives and similar packages
Based on the "Science and Data Analysis" category.
Alternatively, view vectormath alternatives based on common mentions on social networks and blogs.
-
gonum
Gonum is a set of numeric libraries for the Go programming language. It contains libraries for matrices, statistics, optimization, and more -
gosl
Linear algebra, eigenvalues, FFT, Bessel, elliptic, orthogonal polys, geometry, NURBS, numerical quadrature, 3D transfinite interpolation, random numbers, Mersenne twister, probability distributions, optimisation, differential equations. -
gonum/mat64
DISCONTINUED. The general purpose package for matrix computation. Package mat64 provides basic linear algebra operations for float64 matrices. -
TextRank
:wink: :cyclone: :strawberry: TextRank implementation in Golang with extendable features (summarization, phrase extraction) and multithreading (goroutine). -
sparse
Sparse matrix formats for linear algebra supporting scientific and machine learning applications -
triangolatte
2D triangulation library. Allows translating lines and polygons (both based on points) to the language of GPUs. -
PiHex
PiHex Library, written in Go, generates a hexadecimal number sequence in the number Pi in the range from 0 to 10,000,000. -
GoStats
GoStats is a go library for math statistics mostly used in ML domains, it covers most of the statistical measures functions. -
mudlark-go
DISCONTINUED. A collection of packages providing (hopefully) useful code for use in software using Google's Go programming language.
CodeRabbit: AI Code Reviews for Developers
Do you think we are missing an alternative of vectormath or a related project?
README
Vectormath for Go
This is an adaptation of the scalar C functions from Sony's Vector Math library, as found in the Bullet-2.79 source code. (Note that the current svn for Bullet retains a subset of this library in a different location.) The full library can be found in the following directory of the Bullet-2.79 source tarball:
Extras/vectormathlibrary/include/vectormath/scalar/c
Special thanks to Sony Computer Entertainment Inc. for allowing the use of their Vector Math library under a BSD-style license, which made this possible.
Approach
Start with a direct conversion of the Sony library to Go. (This was shipping code, so we will assume it's correct.) Then iterate to make it more Go-like, while trying to balance the twin goals of same/better performance and maintaining readability.
The C version of the library, as opposed to the C++ version, was chosen as a starting point mainly to avoid the distraction of function renaming, as the C++ version of Sony's library relies somewhat on operator and function overloads, which have no direct equivalent in Go.
Note that the original C library provides two versions of each file, e.g., vec_aos.h and vec_aos_v.h. I've brought over the former as opposed to the latter, since this simplifies things for beginners. The 'result' argument is always a pointer passed as the first argument to a function. Currently, the only types used in this library that are passed by value are simple types, e.g., float and int. Everything else is a pointer. (This should, in theory, simplify memory thrash considerations as well. In practice.. I have no idea. :)
Future Direction
Further research is required for determining:
- What makes the most sense for optimizing this code for SIMD
- Whether we should be passing vectors, etc., by value instead of reference
- If we should continue to declare vectors as individual values as opposed to an array of values. This would avoid the branching currently required to access members by index, but would disallow accessing members by common name (x, y, z and w) due to Golang's lack of a union equivalent.
- Whether it makes sense to stay with 32-bit, or if we would get the same performance with 64-bit
Feedback on this library is welcome and appreciated, though I make no promises about my ability to deliver on anything beyond what you see here. :)
License
I have licensed my modifications under a license similar to that of the original library on which this is based. See the LICENSE file for more details.
*Note that all licence references and agreements mentioned in the vectormath README section above
are relevant to that project's source code only.