float

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: BSD-2-Clause Imports: 2 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SliceValueOf

func SliceValueOf[T DType](v Slice) []T

SliceValueOf converts a Slice value to a concrete slice of DType values.

func ValueOf

func ValueOf[T DType](i Float) T

ValueOf converts a Float value to a concrete DType.

Types

type DType

type DType interface {
	float32 | float64
}

DType is the primary type constraint for matrices defined in this package.

type Float

type Float interface {
	// F32 returns the value as float32, converting it if necessary.
	F32() float32
	// F64 returns the value as float64, converting it if necessary.
	F64() float64
	// BitSize returns the size in bits of the internal float value type.
	BitSize() int
}

Float is implemented by any value that can be resolved to the types constrained by DType.

func Interface

func Interface[T DType](v T) Float

Interface converts a concrete DType value to an internal representation compatible with Float.

type Slice

type Slice interface {
	F32() []float32
	F64() []float64
	BitSize() int
	Len() int
	Equals(other Slice) bool
	InDelta(other Slice, delta float64) bool
}

Slice is implemented by any value that can be resolved to a slice of a type constrained by DType.

func Make added in v1.1.0

func Make[T DType](v ...T) Slice

Make converts a concrete slice of DType values to an internal representation compatible with Slice.

Jump to

Keyboard shortcuts

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