ndvek

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 3 Imported by: 2

README

NDArray library for golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Linspace

func Linspace(start, stop float64, numPoints int) []float64

func ProdInt

func ProdInt(x []int) int

Types

type NdArray

type NdArray struct {
	Data []float64
	// contains filtered or unexported fields
}

NdArray represents a multi-dimensional array with shape and data.

func Add

func Add(a, b *NdArray) (*NdArray, error)

Add performs element-wise addition with broadcasting.

func ApplyOp

func ApplyOp(a, b *NdArray, op func(float64, float64) float64) (*NdArray, error)

applyOp applies an arithmetic operation with broadcasting.

func Divide

func Divide(a, b *NdArray) (*NdArray, error)

Divide performs element-wise division with broadcasting.

func Multiply

func Multiply(a, b *NdArray) (*NdArray, error)

Multiply performs element-wise multiplication with broadcasting.

func NewNdArray

func NewNdArray(shape []int, data []float64) (*NdArray, error)

NewNdArray creates a new NdArray given a shape and initial data.

func Subtract

func Subtract(a, b *NdArray) (*NdArray, error)

Subtract performs element-wise subtraction with broadcasting.

func Zeros

func Zeros(shape []int) *NdArray

func (*NdArray) AddScalar

func (a *NdArray) AddScalar(b float64) *NdArray

func (*NdArray) ApplyHadamardOp

func (a *NdArray) ApplyHadamardOp(op func(float64) float64) error

func (*NdArray) Get

func (a *NdArray) Get(index []int) (float64, error)

func (*NdArray) InsertAxis

func (x *NdArray) InsertAxis(pos int) *NdArray

func (*NdArray) MulScalar

func (a *NdArray) MulScalar(b float64) *NdArray

func (*NdArray) Reshape

func (x *NdArray) Reshape(shape []int) *NdArray

func (*NdArray) Shape

func (a *NdArray) Shape() []int

Shape returns the shape of the ndarray.

func (*NdArray) SubScalar

func (a *NdArray) SubScalar(b float64) *NdArray

Jump to

Keyboard shortcuts

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