Help us shape the future of Go! Take the 2026 Go Developer Survey

nd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package nd applies the special functions of package special element-wise to go-ndarray arrays (github.com/go-ndarray/ndarray).

Every real dtype is accepted. A Float32 input gives a Float32 result (computed in float64 and rounded once); Float64, integer and Bool inputs give Float64. Complex inputs are rejected with ndarray.ErrDType. Functions of several arguments broadcast them against each other as NumPy does. Large arrays are split across GOMAXPROCS goroutines.

Each function documents nothing beyond its scalar counterpart in package special, whose accuracy and conventions it inherits exactly: the element results are bit-identical to calling the scalar function.

Index

Constants

This section is empty.

Variables

View Source
var ErrShape = errors.New("nd: shapes cannot be broadcast")

ErrShape is returned (wrapped) when arguments cannot be broadcast together.

Functions

func Beta

func Beta(a, b *ndarray.Array) (*ndarray.Array, error)

Beta applies special.Beta element-wise to the broadcast arguments.

func BetaInc

func BetaInc(a, b, x *ndarray.Array) (*ndarray.Array, error)

BetaInc applies special.BetaInc element-wise to the broadcast arguments.

func BetaIncC

func BetaIncC(a, b, x *ndarray.Array) (*ndarray.Array, error)

BetaIncC applies special.BetaIncC element-wise to the broadcast arguments.

func BetaIncCInv

func BetaIncCInv(a, b, q *ndarray.Array) (*ndarray.Array, error)

BetaIncCInv applies special.BetaIncCInv element-wise to the broadcast arguments.

func BetaIncInv

func BetaIncInv(a, b, p *ndarray.Array) (*ndarray.Array, error)

BetaIncInv applies special.BetaIncInv element-wise to the broadcast arguments.

func Binom

func Binom(a, b *ndarray.Array) (*ndarray.Array, error)

Binom applies special.Binom element-wise to the broadcast arguments.

func Comb

func Comb(n, k *ndarray.Array) (*ndarray.Array, error)

Comb applies special.Comb element-wise to the broadcast arguments; arguments that are not integers give NaN.

func Digamma

func Digamma(x *ndarray.Array) (*ndarray.Array, error)

Digamma applies special.Digamma element-wise.

func EllipE

func EllipE(x *ndarray.Array) (*ndarray.Array, error)

EllipE applies special.EllipE element-wise.

func EllipK

func EllipK(x *ndarray.Array) (*ndarray.Array, error)

EllipK applies special.EllipK element-wise.

func EllipKm1

func EllipKm1(x *ndarray.Array) (*ndarray.Array, error)

EllipKm1 applies special.EllipKm1 element-wise.

func Erf

func Erf(x *ndarray.Array) (*ndarray.Array, error)

Erf applies special.Erf element-wise.

func ErfInv

func ErfInv(x *ndarray.Array) (*ndarray.Array, error)

ErfInv applies special.ErfInv element-wise.

func Erfc

func Erfc(x *ndarray.Array) (*ndarray.Array, error)

Erfc applies special.Erfc element-wise.

func ErfcInv

func ErfcInv(x *ndarray.Array) (*ndarray.Array, error)

ErfcInv applies special.ErfcInv element-wise.

func Erfcx

func Erfcx(x *ndarray.Array) (*ndarray.Array, error)

Erfcx applies special.Erfcx element-wise.

func Expit

func Expit(x *ndarray.Array) (*ndarray.Array, error)

Expit applies special.Expit element-wise.

func Factorial

func Factorial(x *ndarray.Array) (*ndarray.Array, error)

Factorial applies special.Factorial element-wise.

func Factorial2

func Factorial2(n *ndarray.Array) (*ndarray.Array, error)

Factorial2 applies special.Factorial2 element-wise; non-integers give NaN.

func Gamma

func Gamma(x *ndarray.Array) (*ndarray.Array, error)

Gamma applies special.Gamma element-wise.

func GammaP

func GammaP(a, x *ndarray.Array) (*ndarray.Array, error)

GammaP applies special.GammaP element-wise to the broadcast arguments.

func GammaPInv

func GammaPInv(a, p *ndarray.Array) (*ndarray.Array, error)

GammaPInv applies special.GammaPInv element-wise to the broadcast arguments.

func GammaQ

func GammaQ(a, x *ndarray.Array) (*ndarray.Array, error)

GammaQ applies special.GammaQ element-wise to the broadcast arguments.

func GammaQInv

func GammaQInv(a, q *ndarray.Array) (*ndarray.Array, error)

GammaQInv applies special.GammaQInv element-wise to the broadcast arguments.

func GammaSign

func GammaSign(x *ndarray.Array) (*ndarray.Array, error)

GammaSign applies special.GammaSign element-wise.

func HurwitzZeta

func HurwitzZeta(a, b *ndarray.Array) (*ndarray.Array, error)

HurwitzZeta applies special.HurwitzZeta element-wise to the broadcast arguments.

func I0

func I0(x *ndarray.Array) (*ndarray.Array, error)

I0 applies special.I0 element-wise.

func I0e

func I0e(x *ndarray.Array) (*ndarray.Array, error)

I0e applies special.I0e element-wise.

func I1

func I1(x *ndarray.Array) (*ndarray.Array, error)

I1 applies special.I1 element-wise.

func I1e

func I1e(x *ndarray.Array) (*ndarray.Array, error)

I1e applies special.I1e element-wise.

func In

func In(n, x *ndarray.Array) (*ndarray.Array, error)

In applies special.In element-wise; an order that is not an integer gives NaN.

func Iv

func Iv(v, x *ndarray.Array) (*ndarray.Array, error)

Iv applies special.Iv element-wise to the broadcast arguments.

func Ive

func Ive(v, x *ndarray.Array) (*ndarray.Array, error)

Ive applies special.Ive element-wise to the broadcast arguments.

func J0

func J0(x *ndarray.Array) (*ndarray.Array, error)

Bessel functions. J0 applies special.J0 element-wise.

func J1

func J1(x *ndarray.Array) (*ndarray.Array, error)

J1 applies special.J1 element-wise.

func Jn

func Jn(n, x *ndarray.Array) (*ndarray.Array, error)

Jn applies special.Jn element-wise; an order that is not an integer gives NaN.

func Jv

func Jv(v, x *ndarray.Array) (*ndarray.Array, error)

Jv applies special.Jv element-wise to the broadcast arguments.

func K0

func K0(x *ndarray.Array) (*ndarray.Array, error)

K0 applies special.K0 element-wise.

func K0e

func K0e(x *ndarray.Array) (*ndarray.Array, error)

K0e applies special.K0e element-wise.

func K1

func K1(x *ndarray.Array) (*ndarray.Array, error)

K1 applies special.K1 element-wise.

func K1e

func K1e(x *ndarray.Array) (*ndarray.Array, error)

K1e applies special.K1e element-wise.

func Kn

func Kn(n, x *ndarray.Array) (*ndarray.Array, error)

Kn applies special.Kn element-wise; an order that is not an integer gives NaN.

func Kv

func Kv(v, x *ndarray.Array) (*ndarray.Array, error)

Kv applies special.Kv element-wise to the broadcast arguments.

func Kve

func Kve(v, x *ndarray.Array) (*ndarray.Array, error)

Kve applies special.Kve element-wise to the broadcast arguments.

func Log1pExp

func Log1pExp(x *ndarray.Array) (*ndarray.Array, error)

Log1pExp applies special.Log1pExp element-wise.

func LogBeta

func LogBeta(a, b *ndarray.Array) (*ndarray.Array, error)

LogBeta applies special.LogBeta element-wise to the broadcast arguments.

func LogExpit

func LogExpit(x *ndarray.Array) (*ndarray.Array, error)

LogExpit applies special.LogExpit element-wise.

func LogFactorial

func LogFactorial(x *ndarray.Array) (*ndarray.Array, error)

LogFactorial applies special.LogFactorial element-wise.

func LogGamma

func LogGamma(x *ndarray.Array) (*ndarray.Array, error)

LogGamma applies special.LogGamma element-wise.

func LogNdtr

func LogNdtr(x *ndarray.Array) (*ndarray.Array, error)

LogNdtr applies special.LogNdtr element-wise.

func LogSoftmax

func LogSoftmax(x *ndarray.Array) (*ndarray.Array, error)

LogSoftmax returns x - LogSumExp(x) over all elements of x, with x's shape (special.LogSoftmax).

func LogSumExp

func LogSumExp(x *ndarray.Array) (float64, error)

LogSumExp returns log Σ exp(x) over all elements of x (special.LogSumExp).

func Logit

func Logit(x *ndarray.Array) (*ndarray.Array, error)

Logit applies special.Logit element-wise.

func Map1

func Map1(f func(float64) float64, a *ndarray.Array) (*ndarray.Array, error)

Map1 applies f element-wise to a.

func Map2

func Map2(f func(x, y float64) float64, a, b *ndarray.Array) (*ndarray.Array, error)

Map2 applies f element-wise to the broadcast pair (a, b).

func Map3

func Map3(f func(x, y, z float64) float64, a, b, c *ndarray.Array) (*ndarray.Array, error)

Map3 applies f element-wise to the broadcast triple (a, b, c).

func Ndtr

func Ndtr(x *ndarray.Array) (*ndarray.Array, error)

Ndtr applies special.Ndtr element-wise.

func Ndtri

func Ndtri(x *ndarray.Array) (*ndarray.Array, error)

Ndtri applies special.Ndtri element-wise.

func Perm

func Perm(n, k *ndarray.Array) (*ndarray.Array, error)

Perm applies special.Perm element-wise to the broadcast arguments; arguments that are not integers give NaN.

func Polygamma

func Polygamma(n, x *ndarray.Array) (*ndarray.Array, error)

Polygamma applies special.Polygamma element-wise to the broadcast arguments; an n that is not an integer gives NaN.

func Softmax

func Softmax(x *ndarray.Array) (*ndarray.Array, error)

Softmax returns exp(x)/Σ exp(x) over all elements of x, with x's shape (special.Softmax).

func Xlog1py

func Xlog1py(a, b *ndarray.Array) (*ndarray.Array, error)

Xlog1py applies special.Xlog1py element-wise to the broadcast arguments.

func Xlogy

func Xlogy(a, b *ndarray.Array) (*ndarray.Array, error)

Xlogy applies special.Xlogy element-wise to the broadcast arguments.

func Y0

func Y0(x *ndarray.Array) (*ndarray.Array, error)

Y0 applies special.Y0 element-wise.

func Y1

func Y1(x *ndarray.Array) (*ndarray.Array, error)

Y1 applies special.Y1 element-wise.

func Yn

func Yn(n, x *ndarray.Array) (*ndarray.Array, error)

Yn applies special.Yn element-wise; an order that is not an integer gives NaN.

func Yv

func Yv(v, x *ndarray.Array) (*ndarray.Array, error)

Yv applies special.Yv element-wise to the broadcast arguments.

func Zeta

func Zeta(x *ndarray.Array) (*ndarray.Array, error)

Zeta applies special.Zeta element-wise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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