Documentation

Overview

Package tensor provides types that implement n-dimensional arrays.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Date32

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

Date32 is an n-dim array of date32s.

func NewDate32

func NewDate32(data *array.Data, shape, strides []int64, names []string) *Date32

NewDate32 returns a new n-dimensional array of date32s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Date32) Data

func (tb *Date32) Data() *array.Data

func (*Date32) DataType

func (tb *Date32) DataType() arrow.DataType

func (*Date32) Date32Values

func (tsr *Date32) Date32Values() []arrow.Date32

func (*Date32) DimName

func (tb *Date32) DimName(i int) string

func (*Date32) DimNames

func (tb *Date32) DimNames() []string

func (*Date32) IsColMajor

func (tb *Date32) IsColMajor() bool

func (*Date32) IsContiguous

func (tb *Date32) IsContiguous() bool

func (*Date32) IsMutable

func (tb *Date32) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Date32) IsRowMajor

func (tb *Date32) IsRowMajor() bool

func (*Date32) Len

func (tb *Date32) Len() int

func (*Date32) NumDims

func (tb *Date32) NumDims() int

func (*Date32) Release

func (tb *Date32) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Date32) Retain

func (tb *Date32) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Date32) Shape

func (tb *Date32) Shape() []int64

func (*Date32) Strides

func (tb *Date32) Strides() []int64

func (*Date32) Value

func (tsr *Date32) Value(i []int64) arrow.Date32

type Date64

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

Date64 is an n-dim array of date64s.

func NewDate64

func NewDate64(data *array.Data, shape, strides []int64, names []string) *Date64

NewDate64 returns a new n-dimensional array of date64s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Date64) Data

func (tb *Date64) Data() *array.Data

func (*Date64) DataType

func (tb *Date64) DataType() arrow.DataType

func (*Date64) Date64Values

func (tsr *Date64) Date64Values() []arrow.Date64

func (*Date64) DimName

func (tb *Date64) DimName(i int) string

func (*Date64) DimNames

func (tb *Date64) DimNames() []string

func (*Date64) IsColMajor

func (tb *Date64) IsColMajor() bool

func (*Date64) IsContiguous

func (tb *Date64) IsContiguous() bool

func (*Date64) IsMutable

func (tb *Date64) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Date64) IsRowMajor

func (tb *Date64) IsRowMajor() bool

func (*Date64) Len

func (tb *Date64) Len() int

func (*Date64) NumDims

func (tb *Date64) NumDims() int

func (*Date64) Release

func (tb *Date64) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Date64) Retain

func (tb *Date64) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Date64) Shape

func (tb *Date64) Shape() []int64

func (*Date64) Strides

func (tb *Date64) Strides() []int64

func (*Date64) Value

func (tsr *Date64) Value(i []int64) arrow.Date64

type Float32

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

Float32 is an n-dim array of float32s.

func NewFloat32

func NewFloat32(data *array.Data, shape, strides []int64, names []string) *Float32

NewFloat32 returns a new n-dimensional array of float32s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Float32) Data

func (tb *Float32) Data() *array.Data

func (*Float32) DataType

func (tb *Float32) DataType() arrow.DataType

func (*Float32) DimName

func (tb *Float32) DimName(i int) string

func (*Float32) DimNames

func (tb *Float32) DimNames() []string

func (*Float32) Float32Values

func (tsr *Float32) Float32Values() []float32

func (*Float32) IsColMajor

func (tb *Float32) IsColMajor() bool

func (*Float32) IsContiguous

func (tb *Float32) IsContiguous() bool

func (*Float32) IsMutable

func (tb *Float32) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Float32) IsRowMajor

func (tb *Float32) IsRowMajor() bool

func (*Float32) Len

func (tb *Float32) Len() int

func (*Float32) NumDims

func (tb *Float32) NumDims() int

func (*Float32) Release

func (tb *Float32) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Float32) Retain

func (tb *Float32) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Float32) Shape

func (tb *Float32) Shape() []int64

func (*Float32) Strides

func (tb *Float32) Strides() []int64

func (*Float32) Value

func (tsr *Float32) Value(i []int64) float32

type Float64

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

Float64 is an n-dim array of float64s.

func NewFloat64

func NewFloat64(data *array.Data, shape, strides []int64, names []string) *Float64

NewFloat64 returns a new n-dimensional array of float64s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Float64) Data

func (tb *Float64) Data() *array.Data

func (*Float64) DataType

func (tb *Float64) DataType() arrow.DataType

func (*Float64) DimName

func (tb *Float64) DimName(i int) string

func (*Float64) DimNames

func (tb *Float64) DimNames() []string

func (*Float64) Float64Values

func (tsr *Float64) Float64Values() []float64

func (*Float64) IsColMajor

func (tb *Float64) IsColMajor() bool

func (*Float64) IsContiguous

func (tb *Float64) IsContiguous() bool

func (*Float64) IsMutable

func (tb *Float64) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Float64) IsRowMajor

func (tb *Float64) IsRowMajor() bool

func (*Float64) Len

func (tb *Float64) Len() int

func (*Float64) NumDims

func (tb *Float64) NumDims() int

func (*Float64) Release

func (tb *Float64) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Float64) Retain

func (tb *Float64) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Float64) Shape

func (tb *Float64) Shape() []int64

func (*Float64) Strides

func (tb *Float64) Strides() []int64

func (*Float64) Value

func (tsr *Float64) Value(i []int64) float64

type Int16

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

Int16 is an n-dim array of int16s.

func NewInt16

func NewInt16(data *array.Data, shape, strides []int64, names []string) *Int16

NewInt16 returns a new n-dimensional array of int16s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Int16) Data

func (tb *Int16) Data() *array.Data

func (*Int16) DataType

func (tb *Int16) DataType() arrow.DataType

func (*Int16) DimName

func (tb *Int16) DimName(i int) string

func (*Int16) DimNames

func (tb *Int16) DimNames() []string

func (*Int16) Int16Values

func (tsr *Int16) Int16Values() []int16

func (*Int16) IsColMajor

func (tb *Int16) IsColMajor() bool

func (*Int16) IsContiguous

func (tb *Int16) IsContiguous() bool

func (*Int16) IsMutable

func (tb *Int16) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Int16) IsRowMajor

func (tb *Int16) IsRowMajor() bool

func (*Int16) Len

func (tb *Int16) Len() int

func (*Int16) NumDims

func (tb *Int16) NumDims() int

func (*Int16) Release

func (tb *Int16) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Int16) Retain

func (tb *Int16) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Int16) Shape

func (tb *Int16) Shape() []int64

func (*Int16) Strides

func (tb *Int16) Strides() []int64

func (*Int16) Value

func (tsr *Int16) Value(i []int64) int16

type Int32

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

Int32 is an n-dim array of int32s.

func NewInt32

func NewInt32(data *array.Data, shape, strides []int64, names []string) *Int32

NewInt32 returns a new n-dimensional array of int32s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Int32) Data

func (tb *Int32) Data() *array.Data

func (*Int32) DataType

func (tb *Int32) DataType() arrow.DataType

func (*Int32) DimName

func (tb *Int32) DimName(i int) string

func (*Int32) DimNames

func (tb *Int32) DimNames() []string

func (*Int32) Int32Values

func (tsr *Int32) Int32Values() []int32

func (*Int32) IsColMajor

func (tb *Int32) IsColMajor() bool

func (*Int32) IsContiguous

func (tb *Int32) IsContiguous() bool

func (*Int32) IsMutable

func (tb *Int32) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Int32) IsRowMajor

func (tb *Int32) IsRowMajor() bool

func (*Int32) Len

func (tb *Int32) Len() int

func (*Int32) NumDims

func (tb *Int32) NumDims() int

func (*Int32) Release

func (tb *Int32) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Int32) Retain

func (tb *Int32) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Int32) Shape

func (tb *Int32) Shape() []int64

func (*Int32) Strides

func (tb *Int32) Strides() []int64

func (*Int32) Value

func (tsr *Int32) Value(i []int64) int32

type Int64

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

Int64 is an n-dim array of int64s.

func NewInt64

func NewInt64(data *array.Data, shape, strides []int64, names []string) *Int64

NewInt64 returns a new n-dimensional array of int64s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Int64) Data

func (tb *Int64) Data() *array.Data

func (*Int64) DataType

func (tb *Int64) DataType() arrow.DataType

func (*Int64) DimName

func (tb *Int64) DimName(i int) string

func (*Int64) DimNames

func (tb *Int64) DimNames() []string

func (*Int64) Int64Values

func (tsr *Int64) Int64Values() []int64

func (*Int64) IsColMajor

func (tb *Int64) IsColMajor() bool

func (*Int64) IsContiguous

func (tb *Int64) IsContiguous() bool

func (*Int64) IsMutable

func (tb *Int64) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Int64) IsRowMajor

func (tb *Int64) IsRowMajor() bool

func (*Int64) Len

func (tb *Int64) Len() int

func (*Int64) NumDims

func (tb *Int64) NumDims() int

func (*Int64) Release

func (tb *Int64) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Int64) Retain

func (tb *Int64) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Int64) Shape

func (tb *Int64) Shape() []int64

func (*Int64) Strides

func (tb *Int64) Strides() []int64

func (*Int64) Value

func (tsr *Int64) Value(i []int64) int64

type Int8

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

Int8 is an n-dim array of int8s.

func NewInt8

func NewInt8(data *array.Data, shape, strides []int64, names []string) *Int8

NewInt8 returns a new n-dimensional array of int8s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Int8) Data

func (tb *Int8) Data() *array.Data

func (*Int8) DataType

func (tb *Int8) DataType() arrow.DataType

func (*Int8) DimName

func (tb *Int8) DimName(i int) string

func (*Int8) DimNames

func (tb *Int8) DimNames() []string

func (*Int8) Int8Values

func (tsr *Int8) Int8Values() []int8

func (*Int8) IsColMajor

func (tb *Int8) IsColMajor() bool

func (*Int8) IsContiguous

func (tb *Int8) IsContiguous() bool

func (*Int8) IsMutable

func (tb *Int8) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Int8) IsRowMajor

func (tb *Int8) IsRowMajor() bool

func (*Int8) Len

func (tb *Int8) Len() int

func (*Int8) NumDims

func (tb *Int8) NumDims() int

func (*Int8) Release

func (tb *Int8) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Int8) Retain

func (tb *Int8) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Int8) Shape

func (tb *Int8) Shape() []int64

func (*Int8) Strides

func (tb *Int8) Strides() []int64

func (*Int8) Value

func (tsr *Int8) Value(i []int64) int8

type Interface

type Interface interface {
	// Retain increases the reference count by 1.
	// Retain may be called simultaneously from multiple goroutines.
	Retain()

	// Release decreases the reference count by 1.
	// Release may be called simultaneously from multiple goroutines.
	// When the reference count goes to zero, the memory is freed.
	Release()

	// Len returns the number of elements in the tensor.
	Len() int

	// Shape returns the size - in each dimension - of the tensor.
	Shape() []int64

	// Strides returns the number of bytes to step in each dimension when traversing the tensor.
	Strides() []int64

	// NumDims returns the number of dimensions of the tensor.
	NumDims() int

	// DimName returns the name of the i-th dimension.
	DimName(i int) string

	// DimNames returns the names for all dimensions
	DimNames() []string

	DataType() arrow.DataType
	Data() *array.Data

	// IsMutable returns whether the underlying data buffer is mutable.
	IsMutable() bool
	IsContiguous() bool
	IsRowMajor() bool
	IsColMajor() bool
}

Interface represents an n-dimensional array of numerical data.

func New

func New(data *array.Data, shape, strides []int64, names []string) Interface

New returns a new n-dim array from the provided backing data and the shape and strides. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

New panics if the backing data is not a numerical type.

type Uint16

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

Uint16 is an n-dim array of uint16s.

func NewUint16

func NewUint16(data *array.Data, shape, strides []int64, names []string) *Uint16

NewUint16 returns a new n-dimensional array of uint16s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Uint16) Data

func (tb *Uint16) Data() *array.Data

func (*Uint16) DataType

func (tb *Uint16) DataType() arrow.DataType

func (*Uint16) DimName

func (tb *Uint16) DimName(i int) string

func (*Uint16) DimNames

func (tb *Uint16) DimNames() []string

func (*Uint16) IsColMajor

func (tb *Uint16) IsColMajor() bool

func (*Uint16) IsContiguous

func (tb *Uint16) IsContiguous() bool

func (*Uint16) IsMutable

func (tb *Uint16) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Uint16) IsRowMajor

func (tb *Uint16) IsRowMajor() bool

func (*Uint16) Len

func (tb *Uint16) Len() int

func (*Uint16) NumDims

func (tb *Uint16) NumDims() int

func (*Uint16) Release

func (tb *Uint16) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Uint16) Retain

func (tb *Uint16) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Uint16) Shape

func (tb *Uint16) Shape() []int64

func (*Uint16) Strides

func (tb *Uint16) Strides() []int64

func (*Uint16) Uint16Values

func (tsr *Uint16) Uint16Values() []uint16

func (*Uint16) Value

func (tsr *Uint16) Value(i []int64) uint16

type Uint32

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

Uint32 is an n-dim array of uint32s.

func NewUint32

func NewUint32(data *array.Data, shape, strides []int64, names []string) *Uint32

NewUint32 returns a new n-dimensional array of uint32s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Uint32) Data

func (tb *Uint32) Data() *array.Data

func (*Uint32) DataType

func (tb *Uint32) DataType() arrow.DataType

func (*Uint32) DimName

func (tb *Uint32) DimName(i int) string

func (*Uint32) DimNames

func (tb *Uint32) DimNames() []string

func (*Uint32) IsColMajor

func (tb *Uint32) IsColMajor() bool

func (*Uint32) IsContiguous

func (tb *Uint32) IsContiguous() bool

func (*Uint32) IsMutable

func (tb *Uint32) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Uint32) IsRowMajor

func (tb *Uint32) IsRowMajor() bool

func (*Uint32) Len

func (tb *Uint32) Len() int

func (*Uint32) NumDims

func (tb *Uint32) NumDims() int

func (*Uint32) Release

func (tb *Uint32) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Uint32) Retain

func (tb *Uint32) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Uint32) Shape

func (tb *Uint32) Shape() []int64

func (*Uint32) Strides

func (tb *Uint32) Strides() []int64

func (*Uint32) Uint32Values

func (tsr *Uint32) Uint32Values() []uint32

func (*Uint32) Value

func (tsr *Uint32) Value(i []int64) uint32

type Uint64

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

Uint64 is an n-dim array of uint64s.

func NewUint64

func NewUint64(data *array.Data, shape, strides []int64, names []string) *Uint64

NewUint64 returns a new n-dimensional array of uint64s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Uint64) Data

func (tb *Uint64) Data() *array.Data

func (*Uint64) DataType

func (tb *Uint64) DataType() arrow.DataType

func (*Uint64) DimName

func (tb *Uint64) DimName(i int) string

func (*Uint64) DimNames

func (tb *Uint64) DimNames() []string

func (*Uint64) IsColMajor

func (tb *Uint64) IsColMajor() bool

func (*Uint64) IsContiguous

func (tb *Uint64) IsContiguous() bool

func (*Uint64) IsMutable

func (tb *Uint64) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Uint64) IsRowMajor

func (tb *Uint64) IsRowMajor() bool

func (*Uint64) Len

func (tb *Uint64) Len() int

func (*Uint64) NumDims

func (tb *Uint64) NumDims() int

func (*Uint64) Release

func (tb *Uint64) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Uint64) Retain

func (tb *Uint64) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Uint64) Shape

func (tb *Uint64) Shape() []int64

func (*Uint64) Strides

func (tb *Uint64) Strides() []int64

func (*Uint64) Uint64Values

func (tsr *Uint64) Uint64Values() []uint64

func (*Uint64) Value

func (tsr *Uint64) Value(i []int64) uint64

type Uint8

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

Uint8 is an n-dim array of uint8s.

func NewUint8

func NewUint8(data *array.Data, shape, strides []int64, names []string) *Uint8

NewUint8 returns a new n-dimensional array of uint8s. If strides is nil, row-major strides will be inferred. If names is nil, a slice of empty strings will be created.

func (*Uint8) Data

func (tb *Uint8) Data() *array.Data

func (*Uint8) DataType

func (tb *Uint8) DataType() arrow.DataType

func (*Uint8) DimName

func (tb *Uint8) DimName(i int) string

func (*Uint8) DimNames

func (tb *Uint8) DimNames() []string

func (*Uint8) IsColMajor

func (tb *Uint8) IsColMajor() bool

func (*Uint8) IsContiguous

func (tb *Uint8) IsContiguous() bool

func (*Uint8) IsMutable

func (tb *Uint8) IsMutable() bool

IsMutable returns whether the underlying data buffer is mutable.

func (*Uint8) IsRowMajor

func (tb *Uint8) IsRowMajor() bool

func (*Uint8) Len

func (tb *Uint8) Len() int

func (*Uint8) NumDims

func (tb *Uint8) NumDims() int

func (*Uint8) Release

func (tb *Uint8) Release()

Release decreases the reference count by 1. Release may be called simultaneously from multiple goroutines. When the reference count goes to zero, the memory is freed.

func (*Uint8) Retain

func (tb *Uint8) Retain()

Retain increases the reference count by 1. Retain may be called simultaneously from multiple goroutines.

func (*Uint8) Shape

func (tb *Uint8) Shape() []int64

func (*Uint8) Strides

func (tb *Uint8) Strides() []int64

func (*Uint8) Uint8Values

func (tsr *Uint8) Uint8Values() []uint8

func (*Uint8) Value

func (tsr *Uint8) Value(i []int64) uint8