ndarray

package
v0.0.0-...-27647ab Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: BSD-3-Clause Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsDim

func AsDim(o any) (bt.Optional[Dim], bool)

func IsSqueezedRange

func IsSqueezedRange(o any) bool

Types

type Dim

type Dim = int64

type Dims

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

func AsDims

func AsDims(s ...any) Dims

func DimsOf

func DimsOf(s ...Dim) Dims

func DimsTo

func DimsTo(l int) Dims

func (Dims) CheckEqualLen

func (ds Dims) CheckEqualLen(o Dims)

func (Dims) Contains

func (ds Dims) Contains(d Dim) bool

func (Dims) Equals

func (ds Dims) Equals(o Dims) bool

func (Dims) Find

func (ds Dims) Find(d Dim) (int, bool)

func (Dims) Get

func (ds Dims) Get(i int) Dim

func (Dims) Len

func (ds Dims) Len() int

func (Dims) Mutate

func (ds Dims) Mutate() MutDims

func (Dims) Prod

func (ds Dims) Prod() Dim

func (Dims) Slice

func (ds Dims) Slice() []Dim

func (Dims) String

func (ds Dims) String() string

func (Dims) Sum

func (ds Dims) Sum() Dim

type Maker

type Maker[T any] struct {
	Shape   Shape
	Strides Strides
	Offset  Dim
	Data    []T
	Default bt.Optional[T]
}

func (Maker[T]) Make

func (m Maker[T]) Make() NdArray[T]

type MutDims

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

func MutDimsTo

func MutDimsTo(l int) MutDims

func NewMutDims

func NewMutDims(l int) MutDims

func (*MutDims) Decay

func (ds *MutDims) Decay() Dims

func (*MutDims) Get

func (ds *MutDims) Get(i int) Dim

func (*MutDims) Len

func (ds *MutDims) Len() int

func (*MutDims) Set

func (ds *MutDims) Set(i int, d Dim)

type NdArray

type NdArray[T any] struct {
	// contains filtered or unexported fields
}

func Map

func Map[F, T any](fn func(F) T, f NdArray[F]) NdArray[T]

func New

func New[T any](shape Shape) NdArray[T]

func OfRange

func OfRange[T bt.Rational](sh Shape) NdArray[T]

func Unnest2

func Unnest2[T any](n [][]T) NdArray[T]

func Unnest3

func Unnest3[T any](n [][][]T) NdArray[T]

func (NdArray[T]) Assign

func (a NdArray[T]) Assign(src NdArray[T])

func (NdArray[T]) At

func (a NdArray[T]) At(idxs Dims) *T

func (NdArray[T]) Data

func (a NdArray[T]) Data() []T

func (NdArray[T]) Flat

func (a NdArray[T]) Flat() []T

func (NdArray[T]) Get

func (a NdArray[T]) Get(idxs Dims) T

func (NdArray[T]) MoveAxis

func (a NdArray[T]) MoveAxis(src, dst int) NdArray[T]

func (NdArray[T]) NestArray

func (a NdArray[T]) NestArray() any

func (NdArray[T]) NestSlice

func (a NdArray[T]) NestSlice() any

func (NdArray[T]) Render

func (a NdArray[T]) Render(w io.Writer, fn func(io.Writer, T))

func (NdArray[T]) Reshape

func (a NdArray[T]) Reshape(nsh Shape) NdArray[T]

func (NdArray[T]) Slice

func (a NdArray[T]) Slice(bs ...any) NdArray[T]

func (NdArray[T]) Squeeze

func (a NdArray[T]) Squeeze() NdArray[T]

func (NdArray[T]) String

func (a NdArray[T]) String() string

func (NdArray[T]) SwapAxes

func (a NdArray[T]) SwapAxes(x, y Dim) NdArray[T]

func (NdArray[T]) Transpose

func (a NdArray[T]) Transpose(axes Dims) NdArray[T]

func (NdArray[T]) View

func (a NdArray[T]) View() View

type Range

type Range struct {
	Start, Stop, Step Dim

	Squeeze bool
}

func CalcRange

func CalcRange(o any, l Dim) Range

func (Range) Check

func (r Range) Check(l Dim) Range

func (Range) Range

func (r Range) Range() bt.Range[Dim]

func (Range) Scalar

func (r Range) Scalar() bt.Optional[Dim]

type Shape

type Shape struct {
	Dims
}

func ShapeOf

func ShapeOf(s ...Dim) Shape

func (Shape) Equals

func (sh Shape) Equals(o Shape) bool

func (Shape) IsScalar

func (sh Shape) IsScalar() bool

func (Shape) NumScalarDims

func (sh Shape) NumScalarDims() int

func (Shape) Order

func (sh Shape) Order() int

func (Shape) Size

func (sh Shape) Size() Dim

type Strides

type Strides struct {
	Dims
}

func CalcStrides

func CalcStrides(shape Shape) Strides

func StridesOf

func StridesOf(s ...Dim) Strides

func (Strides) Equals

func (st Strides) Equals(o Strides) bool

func (Strides) Offset

func (st Strides) Offset(idxs Dims) Dim

type View

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

func ViewOf

func ViewOf(
	shape Shape,
	strides Strides,
	offset Dim,
) View

func (View) DataSize

func (v View) DataSize() Dim

func (View) Equals

func (v View) Equals(o View) bool

func (View) Index

func (v View) Index(idxs Dims) Dim

func (View) Linear

func (v View) Linear() bool

func (View) Offset

func (v View) Offset() Dim

func (View) Shape

func (v View) Shape() Shape

func (View) Slice

func (v View) Slice(bs ...any) View

func (View) Squeeze

func (v View) Squeeze() View

func (View) Strides

func (v View) Strides() Strides

func (View) String

func (v View) String() string

Jump to

Keyboard shortcuts

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