sc128

package
v0.0.0-...-e3d2a19 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Static is the static context
	Static Context
	// Add adds two numbers
	Add = B(Static.Add)
	// Sub subtracts two numbers
	Sub = B(Static.Sub)
	// Mul multiplies two numbers
	Mul = B(Static.Mul)
	// Div divides two numbers
	Div = B(Static.Div)
	// Sin the sine of a number
	Sin = U(Static.Sin)
	// Cos the cosine of a number
	Cos = U(Static.Cos)
	// Exp the base e exponential
	Exp = U(Static.Exp)
	// Log the natural logarithm
	Log = U(Static.Log)
	// Sigmoid the sigmoid of a number
	Sigmoid = U(Static.Sigmoid)
	//TanH the hyperbolic tangent of a number
	TanH = U(Static.TanH)
)

Functions

func B

func B(op Binary) func(a, b Meta) Meta

B converts a binary function into an operator

func Panic

func Panic(a *V) bool

Panic marks a place we should never get to

func U

func U(op Unary) func(a Meta) Meta

U converts a unary function into an operator

Types

type Binary

type Binary func(k Continuation, a, b *V) bool

Binary is a binary function

type Context

type Context struct {
}

Context is a function context

func (*Context) Add

func (context *Context) Add(k Continuation, a, b *V) bool

Add adds two numbers

func (*Context) Cos

func (context *Context) Cos(k Continuation, a *V) bool

Cos the cosine of a number

func (*Context) Div

func (context *Context) Div(k Continuation, a, b *V) bool

Div divides two numbers

func (*Context) Exp

func (context *Context) Exp(k Continuation, a *V) bool

Exp the base e exponential

func (*Context) Log

func (context *Context) Log(k Continuation, a *V) bool

Log the natural logarithm

func (*Context) Mul

func (context *Context) Mul(k Continuation, a, b *V) bool

Mul multiplies two numbers

func (*Context) Sigmoid

func (context *Context) Sigmoid(k Continuation, a *V) bool

Sigmoid the sigmoid of a number

func (*Context) Sin

func (context *Context) Sin(k Continuation, a *V) bool

Sin the sine of a number

func (*Context) Sub

func (context *Context) Sub(k Continuation, a, b *V) bool

Sub subtracts two numbers

func (*Context) TanH

func (context *Context) TanH(k Continuation, a *V) bool

TanH the hyperbolic tangent of a number

type Continuation

type Continuation func(a *V) bool

Continuation is a continuation

type Meta

type Meta func(k Continuation) Continuation

Meta is a function that takes a continuation and return a continuation

type Unary

type Unary func(k Continuation, a *V) bool

Unary is a unary function

type V

type V struct {
	X complex128 // the value
	D complex128 // the derivative
}

V is a value

func Gradient

func Gradient(a Meta) (cost V)

Gradient computes the gradient

func (*V) Meta

func (a *V) Meta() Meta

Meta returns a meta for the value

Jump to

Keyboard shortcuts

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