tmath

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: BSD-3-Clause Imports: 3 Imported by: 2

README

tmath is the Tensor math library

math functions

All the standard library math functions are implemented on *tensor.Tensor.

To properly handle the row-wise indexes, all processing is done using row, cell indexes, with the row indirected through the indexes.

The output result tensor(s) can be the same as the input for all functions (except where specifically noted), to perform an in-place operation on the same data.

The standard Add, Sub, Mul, Div (+, -, *, /) mathematical operators all operate element-wise, with a separate MatMul for matrix multiplication, which operates through gonum routines, for 2D Float64 tensor shapes with no indexes, so that the raw float64 values can be passed directly to gonum.

Documentation

Overview

Package tmath provides basic math operations and functions that operate on tensor.Tensor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(in tensor.Tensor) tensor.Values

func AbsOut

func AbsOut(in tensor.Tensor, out tensor.Values) error

func Acos

func Acos(in tensor.Tensor) tensor.Values

func AcosOut

func AcosOut(in tensor.Tensor, out tensor.Values) error

func Acosh

func Acosh(in tensor.Tensor) tensor.Values

func AcoshOut

func AcoshOut(in tensor.Tensor, out tensor.Values) error

func Add

func Add(a, b tensor.Tensor) tensor.Values

Add adds two tensors into output.

func AddAssign

func AddAssign(a, b tensor.Tensor) error

AddAssign does += add assign values from b into a.

func AddOut

func AddOut(a, b tensor.Tensor, out tensor.Values) error

AddOut adds two tensors into output.

func And

func And(a, b tensor.Tensor) *tensor.Bool

And stores in the output the bool value a || b.

func AndOut

func AndOut(a, b tensor.Tensor, out *tensor.Bool) error

AndOut stores in the output the bool value a || b.

func Asin

func Asin(in tensor.Tensor) tensor.Values

func AsinOut

func AsinOut(in tensor.Tensor, out tensor.Values) error

func Asinh

func Asinh(in tensor.Tensor) tensor.Values

func AsinhOut

func AsinhOut(in tensor.Tensor, out tensor.Values) error

func Assign

func Assign(a, b tensor.Tensor) error

Assign assigns values from b into a.

func Atan

func Atan(in tensor.Tensor) tensor.Values

func Atan2

func Atan2(y, x tensor.Tensor) tensor.Values

func Atan2Out

func Atan2Out(y, x tensor.Tensor, out tensor.Values) error

func AtanOut

func AtanOut(in tensor.Tensor, out tensor.Values) error

func Atanh

func Atanh(in tensor.Tensor) tensor.Values

func AtanhOut

func AtanhOut(in tensor.Tensor, out tensor.Values) error

func Cbrt

func Cbrt(in tensor.Tensor) tensor.Values

func CbrtOut

func CbrtOut(in tensor.Tensor, out tensor.Values) error

func Ceil

func Ceil(in tensor.Tensor) tensor.Values

func CeilOut

func CeilOut(in tensor.Tensor, out tensor.Values) error

func Copysign

func Copysign(x, y tensor.Tensor) tensor.Values

func CopysignOut

func CopysignOut(x, y tensor.Tensor, out tensor.Values) error

func Cos

func Cos(in tensor.Tensor) tensor.Values

func CosOut

func CosOut(in tensor.Tensor, out tensor.Values) error

func Cosh

func Cosh(in tensor.Tensor) tensor.Values

func CoshOut

func CoshOut(in tensor.Tensor, out tensor.Values) error

func Dec

func Dec(a tensor.Tensor) error

Dec decrements values in given tensor by 1.

func Dim

func Dim(x, y tensor.Tensor) tensor.Values

func DimOut

func DimOut(x, y tensor.Tensor, out tensor.Values) error

func Div

func Div(a, b tensor.Tensor) tensor.Values

Div divides tensors into output. always does floating point division, even with integer operands.

func DivAssign

func DivAssign(a, b tensor.Tensor) error

DivAssign does /= divide assign values from b into a.

func DivOut

func DivOut(a, b tensor.Tensor, out tensor.Values) error

DivOut divides two tensors into output.

func Equal

func Equal(a, b tensor.Tensor) *tensor.Bool

Equal stores in the output the bool value a == b.

func EqualOut

func EqualOut(a, b tensor.Tensor, out *tensor.Bool) error

EqualOut stores in the output the bool value a == b.

func Erf

func Erf(in tensor.Tensor) tensor.Values

func ErfOut

func ErfOut(in tensor.Tensor, out tensor.Values) error

func Erfc

func Erfc(in tensor.Tensor) tensor.Values

func ErfcOut

func ErfcOut(in tensor.Tensor, out tensor.Values) error

func Erfcinv

func Erfcinv(in tensor.Tensor) tensor.Values

func ErfcinvOut

func ErfcinvOut(in tensor.Tensor, out tensor.Values) error

func Erfinv

func Erfinv(in tensor.Tensor) tensor.Values

func ErfinvOut

func ErfinvOut(in tensor.Tensor, out tensor.Values) error

func Exp

func Exp(in tensor.Tensor) tensor.Values

func Exp2

func Exp2(in tensor.Tensor) tensor.Values

func Exp2Out

func Exp2Out(in tensor.Tensor, out tensor.Values) error

func ExpOut

func ExpOut(in tensor.Tensor, out tensor.Values) error

func Expm1

func Expm1(in tensor.Tensor) tensor.Values

func Expm1Out

func Expm1Out(in tensor.Tensor, out tensor.Values) error

func Floor

func Floor(in tensor.Tensor) tensor.Values

func FloorOut

func FloorOut(in tensor.Tensor, out tensor.Values) error

func Gamma

func Gamma(in tensor.Tensor) tensor.Values

func GammaOut

func GammaOut(in tensor.Tensor, out tensor.Values) error

func Greater

func Greater(a, b tensor.Tensor) *tensor.Bool

Greater stores in the output the bool value a > b.

func GreaterEqual

func GreaterEqual(a, b tensor.Tensor) *tensor.Bool

GreaterEqual stores in the output the bool value a >= b.

func GreaterEqualOut

func GreaterEqualOut(a, b tensor.Tensor, out *tensor.Bool) error

GreaterEqualOut stores in the output the bool value a >= b.

func GreaterOut

func GreaterOut(a, b tensor.Tensor, out *tensor.Bool) error

GreaterOut stores in the output the bool value a > b.

func Hypot

func Hypot(x, y tensor.Tensor) tensor.Values

func HypotOut

func HypotOut(x, y tensor.Tensor, out tensor.Values) error

func Inc

func Inc(a tensor.Tensor) error

Inc increments values in given tensor by 1.

func J0

func J0(in tensor.Tensor) tensor.Values

func J0Out

func J0Out(in tensor.Tensor, out tensor.Values) error

func J1

func J1(in tensor.Tensor) tensor.Values

func J1Out

func J1Out(in tensor.Tensor, out tensor.Values) error

func Less

func Less(a, b tensor.Tensor) *tensor.Bool

Less stores in the output the bool value a < b.

func LessEqual

func LessEqual(a, b tensor.Tensor) *tensor.Bool

LessEqual stores in the output the bool value a <= b.

func LessEqualOut

func LessEqualOut(a, b tensor.Tensor, out *tensor.Bool) error

LessEqualOut stores in the output the bool value a <= b.

func LessOut

func LessOut(a, b tensor.Tensor, out *tensor.Bool) error

LessOut stores in the output the bool value a < b.

func Log

func Log(in tensor.Tensor) tensor.Values

func Log1p

func Log1p(in tensor.Tensor) tensor.Values

func Log1pOut

func Log1pOut(in tensor.Tensor, out tensor.Values) error

func Log2

func Log2(in tensor.Tensor) tensor.Values

func Log2Out

func Log2Out(in tensor.Tensor, out tensor.Values) error

func Log10

func Log10(in tensor.Tensor) tensor.Values

func Log10Out

func Log10Out(in tensor.Tensor, out tensor.Values) error

func LogOut

func LogOut(in tensor.Tensor, out tensor.Values) error

func Logb

func Logb(in tensor.Tensor) tensor.Values

func LogbOut

func LogbOut(in tensor.Tensor, out tensor.Values) error

func Max

func Max(x, y tensor.Tensor) tensor.Values

func MaxOut

func MaxOut(x, y tensor.Tensor, out tensor.Values) error

func Min

func Min(x, y tensor.Tensor) tensor.Values

func MinOut

func MinOut(x, y tensor.Tensor, out tensor.Values) error

func Mod

func Mod(a, b tensor.Tensor) tensor.Values

Mod performs modulus a%b on tensors into output.

func ModAssign

func ModAssign(a, b tensor.Tensor) error

ModAssign does %= modulus assign values from b into a.

func ModOut

func ModOut(a, b tensor.Tensor, out tensor.Values) error

ModOut performs modulus a%b on tensors into output.

func Mul

func Mul(a, b tensor.Tensor) tensor.Values

Mul multiplies tensors into output.

func MulAssign

func MulAssign(a, b tensor.Tensor) error

MulAssign does *= mul assign values from b into a.

func MulOut

func MulOut(a, b tensor.Tensor, out tensor.Values) error

MulOut multiplies two tensors into output.

func Negate

func Negate(a tensor.Tensor) tensor.Values

Negate stores in the output the bool value -a.

func NegateOut

func NegateOut(a tensor.Tensor, out tensor.Values) error

NegateOut stores in the output the bool value -a.

func Nextafter

func Nextafter(x, y tensor.Tensor) tensor.Values

func NextafterOut

func NextafterOut(x, y tensor.Tensor, out tensor.Values) error

func Not

func Not(a tensor.Tensor) *tensor.Bool

Not stores in the output the bool value !a.

func NotEqual

func NotEqual(a, b tensor.Tensor) *tensor.Bool

NotEqual stores in the output the bool value a != b.

func NotEqualOut

func NotEqualOut(a, b tensor.Tensor, out *tensor.Bool) error

NotEqualOut stores in the output the bool value a != b.

func NotOut

func NotOut(a tensor.Tensor, out *tensor.Bool) error

NotOut stores in the output the bool value !a.

func Or

func Or(a, b tensor.Tensor) *tensor.Bool

Or stores in the output the bool value a || b.

func OrOut

func OrOut(a, b tensor.Tensor, out *tensor.Bool) error

OrOut stores in the output the bool value a || b.

func Pow

func Pow(x, y tensor.Tensor) tensor.Values

func PowOut

func PowOut(x, y tensor.Tensor, out tensor.Values) error

func Remainder

func Remainder(x, y tensor.Tensor) tensor.Values

func RemainderOut

func RemainderOut(x, y tensor.Tensor, out tensor.Values) error

func Round

func Round(in tensor.Tensor) tensor.Values

func RoundOut

func RoundOut(in tensor.Tensor, out tensor.Values) error

func RoundToEven

func RoundToEven(in tensor.Tensor) tensor.Values

func RoundToEvenOut

func RoundToEvenOut(in tensor.Tensor, out tensor.Values) error

func Sin

func Sin(in tensor.Tensor) tensor.Values

func SinOut

func SinOut(in tensor.Tensor, out tensor.Values) error

func Sinh

func Sinh(in tensor.Tensor) tensor.Values

func SinhOut

func SinhOut(in tensor.Tensor, out tensor.Values) error

func Sqrt

func Sqrt(in tensor.Tensor) tensor.Values

func SqrtOut

func SqrtOut(in tensor.Tensor, out tensor.Values) error

func Sub

func Sub(a, b tensor.Tensor) tensor.Values

Sub subtracts tensors into output.

func SubAssign

func SubAssign(a, b tensor.Tensor) error

SubAssign does -= sub assign values from b into a.

func SubOut

func SubOut(a, b tensor.Tensor, out tensor.Values) error

SubOut subtracts two tensors into output.

func Tan

func Tan(in tensor.Tensor) tensor.Values

func TanOut

func TanOut(in tensor.Tensor, out tensor.Values) error

func Tanh

func Tanh(in tensor.Tensor) tensor.Values

func TanhOut

func TanhOut(in tensor.Tensor, out tensor.Values) error

func Trunc

func Trunc(in tensor.Tensor) tensor.Values

func TruncOut

func TruncOut(in tensor.Tensor, out tensor.Values) error

func Y0

func Y0(in tensor.Tensor) tensor.Values

func Y0Out

func Y0Out(in tensor.Tensor, out tensor.Values) error

func Y1

func Y1(in tensor.Tensor) tensor.Values

func Y1Out

func Y1Out(in tensor.Tensor, out tensor.Values) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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