gotype

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 5 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gotype defines several constraints based on Go types supported by the dtypes package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyHalfPrecision

type AnyHalfPrecision interface {
	float16.Float16 | bfloat16.BFloat16
}

AnyHalfPrecision constraints to the compute's representations for half-precision floating point numbers. They are not natively supported by Go, but rather aliases unit16 with extra methods (Float64, Float32, etc).

Consider using HalfPrecision instead.

type Complex

type Complex interface {
	complex64 | complex128
}

Complex constraints to the Go complex types.

type Float

type Float interface {
	float32 | float64
}

Float constraints to continuous native Go numeric types. It doesn't include complex numbers or half-precision types (non-native).

type HalfPrecision

type HalfPrecision[T any] interface {
	AnyHalfPrecision
	Float64() float64
	Float32() float32
	Neg() T
}

HalfPrecision is an interface that represents half-precision floating point numbers, specifically float16 and bfloat16.

It includes the methods to convert to float64 and float32, so it can be used in generic methods.

type HalfPrecisionPtr

type HalfPrecisionPtr[T HalfPrecision[T]] interface {
	*T
	SetFloat32(float32)
	SetFloat64(float64)
}

HalfPrecisionPtr is a pointer to a HalfPrecision wrapper type. It is used when one needs to set the value of a HalfPrecision type from a float32 or float64.

type Integer

type Integer interface {
	int | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
}

Integer constraints to Go native integer types.

type Numeric

type Numeric interface {
	NumericNotComplex | Complex
}

Numeric constraints to the native Go numeric types. It includes complex numbers.

See NumericNotComplex to exclude complex numerics, and Scalar to include non-native types (the half-precision floats).

It doesn't include half-precision types float16.Float16 or bfloat16.BFloat16 because they are not native number types.

type NumericNotComplex

type NumericNotComplex interface {
	Float | Signed | Unsigned
}

NumericNotComplex constraints to native Go numeric types excluding complex numbers.

See also Numeric.

type Scalar

type Scalar interface {
	Numeric | AnyHalfPrecision
}

Scalar constraints to any of the scalar types supported by compute (integers, floats, half-precision floats, and complex numbers).

See ScalarNotComplex to exclude the complex types, and Numeric to exclude non-native types (the half-precision floats).

type ScalarNotComplex

type ScalarNotComplex interface {
	NumericNotComplex | AnyHalfPrecision
}

ScalarNotComplex constraints to scalar types excluding complex numbers.

type Signed

type Signed interface {
	int | int8 | int16 | int32 | int64
}

Signed constraints to Go signed integer types.

type Supported

type Supported interface {
	bool | AnyHalfPrecision | Numeric
}

Supported constraints to the list of compute's supported Go types, including those not native (half-precision).

Notice Go's `int` type is supported but not portable, since it may translate to dtypes Int32 or Int64 depending on the platform. You should prefer using Int32 or Int64 instead of int.

type Unsigned

type Unsigned interface {
	uint8 | uint16 | uint32 | uint64
}

Unsigned constraints to Go unsigned integer types.

Jump to

Keyboard shortcuts

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