rand_go_gx

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package rand_go_gx are Go bindings to the GX package: rand.

Automatically generated by gx/golang/binder/gobindings/bindings.go.tmpl.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	Package *Package
}

Factory create new instance of types used in the package. The compiler associated with the factory defines on what device and with which options methods of the instances created by the factory are compiled for.

func (*Factory) NewPhilox

func (fac *Factory) NewPhilox() *Philox

NewPhilox returns a handle on named type Philox.

func (*Factory) NewRand

func (fac *Factory) NewRand() *Rand

NewRand returns a handle on named type Rand.

func (*Factory) NewbootstrapGenerator

func (fac *Factory) NewbootstrapGenerator() *bootstrapGenerator

NewbootstrapGenerator returns a handle on named type bootstrapGenerator.

type MethodRandBool

type MethodRandBool struct {
	// contains filtered or unexported fields
}

MethodRandBool compiles and runs the GX function Bool for a device. Bool returns pseudo-random boolean values as an array of bool.

func (*MethodRandBool) Run

func (f *MethodRandBool) Run(arg0 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[bool], err error)

Run first compiles Bool for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandBool) String

func (f *MethodRandBool) String() string

type MethodRandFloat32

type MethodRandFloat32 struct {
	// contains filtered or unexported fields
}

MethodRandFloat32 compiles and runs the GX function Float32 for a device. Float32 returns pseudo-random values as an array of float32 uniformly distributed from [0.0, 1.0) (1.0 being excluded).

func (*MethodRandFloat32) Run

func (f *MethodRandFloat32) Run(arg0 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[float32], err error)

Run first compiles Float32 for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandFloat32) String

func (f *MethodRandFloat32) String() string

type MethodRandFloat32MinMax

type MethodRandFloat32MinMax struct {
	// contains filtered or unexported fields
}

MethodRandFloat32MinMax compiles and runs the GX function Float32MinMax for a device. Float32MinMax samples uniform pseudo-random values in [min, max).

func (*MethodRandFloat32MinMax) Run

func (f *MethodRandFloat32MinMax) Run(arg0 types.Atom[float32], arg1 types.Atom[float32], arg2 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[float32], err error)

Run first compiles Float32MinMax for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandFloat32MinMax) String

func (f *MethodRandFloat32MinMax) String() string

type MethodRandFloat64

type MethodRandFloat64 struct {
	// contains filtered or unexported fields
}

MethodRandFloat64 compiles and runs the GX function Float64 for a device. Float64 returns pseudo-random values as an array of float64 uniformly distributed from [0.0, 1.0) (1.0 being excluded).

func (*MethodRandFloat64) Run

func (f *MethodRandFloat64) Run(arg0 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[float64], err error)

Run first compiles Float64 for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandFloat64) String

func (f *MethodRandFloat64) String() string

type MethodRandFloat64MinMax

type MethodRandFloat64MinMax struct {
	// contains filtered or unexported fields
}

MethodRandFloat64MinMax compiles and runs the GX function Float64MinMax for a device. Float64MinMax samples uniform pseudo-random values in [min, max).

func (*MethodRandFloat64MinMax) Run

func (f *MethodRandFloat64MinMax) Run(arg0 types.Atom[float64], arg1 types.Atom[float64], arg2 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[float64], err error)

Run first compiles Float64MinMax for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandFloat64MinMax) String

func (f *MethodRandFloat64MinMax) String() string

type MethodRandInt32

type MethodRandInt32 struct {
	// contains filtered or unexported fields
}

MethodRandInt32 compiles and runs the GX function Int32 for a device. Int32 returns pseudo-random 32-bit values as an array of int32.

func (*MethodRandInt32) Run

func (f *MethodRandInt32) Run(arg0 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[int32], err error)

Run first compiles Int32 for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandInt32) String

func (f *MethodRandInt32) String() string

type MethodRandInt64

type MethodRandInt64 struct {
	// contains filtered or unexported fields
}

MethodRandInt64 compiles and runs the GX function Int64 for a device. Int64 returns pseudo-random 64-bit values as an array of int64.

func (*MethodRandInt64) Run

func (f *MethodRandInt64) Run(arg0 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[int64], err error)

Run first compiles Int64 for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandInt64) String

func (f *MethodRandInt64) String() string

type MethodRandUint32

type MethodRandUint32 struct {
	// contains filtered or unexported fields
}

MethodRandUint32 compiles and runs the GX function Uint32 for a device. Uint32 returns pseudo-random 32-bit values as an array of uint32.

func (*MethodRandUint32) Run

func (f *MethodRandUint32) Run(arg0 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[uint32], err error)

Run first compiles Uint32 for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandUint32) String

func (f *MethodRandUint32) String() string

type MethodRandUint64

type MethodRandUint64 struct {
	// contains filtered or unexported fields
}

MethodRandUint64 compiles and runs the GX function Uint64 for a device. Uint64 returns pseudo-random 64-bit values as an array of uint64.

func (*MethodRandUint64) Run

func (f *MethodRandUint64) Run(arg0 *types.Slice[types.Atom[ir.Int]]) (_ *Rand, _ types.Array[uint64], err error)

Run first compiles Uint64 for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*MethodRandUint64) String

func (f *MethodRandUint64) String() string

type New

type New struct {
	// contains filtered or unexported fields
}

New compiles and runs the GX function New for a device. New returns random values by transforming random values generated by src.

func (*New) Run

func (f *New) Run(arg0 *Philox) (_ *Rand, err error)

Run first compiles New for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*New) String

func (f *New) String() string

type NewPhilox

type NewPhilox struct {
	// contains filtered or unexported fields
}

NewPhilox compiles and runs the GX function NewPhilox for a device. NewPhilox returns a new Philox source seeded with the given values.

func (*NewPhilox) Run

func (f *NewPhilox) Run(arg0 types.Array[uint64]) (_ *Philox, err error)

Run first compiles NewPhilox for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*NewPhilox) String

func (f *NewPhilox) String() string

type NewSource

type NewSource struct {
	// contains filtered or unexported fields
}

NewSource compiles and runs the GX function NewSource for a device. NewSource returns a new source for a random generator using a seed.

func (*NewSource) Run

func (f *NewSource) Run(arg0 types.Atom[int64]) (_ *Philox, err error)

Run first compiles NewSource for a given device and the given arguments. Once compiled, the function is then run with these same arguments. If the shape of the arguments change, the function will panic.

func (*NewSource) String

func (f *NewSource) String() string

type Package

type Package struct {
	Package *PackageIR
	Device  *api.Device
	Factory *Factory

	NewPhilox NewPhilox
	New       New
	NewSource NewSource
	// contains filtered or unexported fields
}

Package is a GX package for a given device. Functions and methods are compiled specifically for that device.

func BuildFor

func BuildFor(dev *api.Device, options ...options.PackageOptionFactory) (*Package, error)

BuildFor loads the GX package rand then returns that package for a given device and options.

func (*Package) AppendOptions

func (cmpl *Package) AppendOptions(options ...options.PackageOptionFactory)

AppendOptions appends options to the compiler.

func (*Package) MarshalPhilox

func (cmpl *Package) MarshalPhilox(val values.Value) (s *Philox, err error)

MarshalPhilox populates the receiver fields with device handles.

func (*Package) MarshalRand

func (cmpl *Package) MarshalRand(val values.Value) (s *Rand, err error)

MarshalRand populates the receiver fields with device handles.

func (*Package) MarshalbootstrapGenerator

func (cmpl *Package) MarshalbootstrapGenerator(val values.Value) (s *bootstrapGenerator, err error)

MarshalbootstrapGenerator populates the receiver fields with device handles.

type PackageIR

type PackageIR struct {
	Runtime *api.Runtime
	IR      *ir.Package
	Tracer  trace.Callback
}

PackageIR is the GX package intermediate representation built for a given runtime, but not yet for a specific device.

func Load

func Load(rtm *api.Runtime) (*PackageIR, error)

Load the GX package for a given backend.

func (*PackageIR) BuildFor

func (pkg *PackageIR) BuildFor(dev *api.Device, options ...options.PackageOptionFactory) *Package

BuildFor returns a package ready to compile for a device and options.

type Philox

type Philox struct {
	// contains filtered or unexported fields
}

Philox stores the handle of Philox on a device.

func (*Philox) Bridge

func (s *Philox) Bridge() types.Bridge

Bridge returns the bridge between the Go value and the GX value.

func (Philox) String

func (s Philox) String() string

type Rand

type Rand struct {
	// contains filtered or unexported fields
}

Rand stores the handle of Rand on a device.

func (Rand) Bool

func (s Rand) Bool() *MethodRandBool

Bool returns a handle to compile method Bool for a device.

func (*Rand) Bridge

func (s *Rand) Bridge() types.Bridge

Bridge returns the bridge between the Go value and the GX value.

func (Rand) Float32

func (s Rand) Float32() *MethodRandFloat32

Float32 returns a handle to compile method Float32 for a device.

func (Rand) Float32MinMax

func (s Rand) Float32MinMax() *MethodRandFloat32MinMax

Float32MinMax returns a handle to compile method Float32MinMax for a device.

func (Rand) Float64

func (s Rand) Float64() *MethodRandFloat64

Float64 returns a handle to compile method Float64 for a device.

func (Rand) Float64MinMax

func (s Rand) Float64MinMax() *MethodRandFloat64MinMax

Float64MinMax returns a handle to compile method Float64MinMax for a device.

func (Rand) Int32

func (s Rand) Int32() *MethodRandInt32

Int32 returns a handle to compile method Int32 for a device.

func (Rand) Int64

func (s Rand) Int64() *MethodRandInt64

Int64 returns a handle to compile method Int64 for a device.

func (Rand) String

func (s Rand) String() string

func (Rand) Uint32

func (s Rand) Uint32() *MethodRandUint32

Uint32 returns a handle to compile method Uint32 for a device.

func (Rand) Uint64

func (s Rand) Uint64() *MethodRandUint64

Uint64 returns a handle to compile method Uint64 for a device.

Jump to

Keyboard shortcuts

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