host

package
v0.0.0-...-a20b597 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2015 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package with host counterparts for the GPU package.

Index

Constants

View Source
const (
	T_MAGIC = 0x0A317423 // First 32-bit word of tensor blob. Identifies the format. Little-endian ASCII for "#t1\n"
)

Variables

This section is empty.

Functions

func Array2D

func Array2D(size0, size1 int) ([]float64, [][]float64)

Allocates a 2D array, as well as the contiguous 1D array backing it.

func Array3D

func Array3D(size0, size1, size2 int) ([]float64, [][][]float64)

Allocates a 3D array, as well as the contiguous 1D array backing it.

func Array4D

func Array4D(size0, size1, size2, size3 int) ([]float64, [][][][]float64)

Allocates a 4D array, as well as the contiguous 1D array backing it.

func Array5D

func Array5D(size0, size1, size2, size3, size4 int) ([]float64, [][][][][]float64)

Allocates a 5D array, as well as the contiguous 1D array backing it.

func ListFloat32ToFloat64

func ListFloat32ToFloat64(in []float32) (out []float64)

func ListFloat64ToFloat32

func ListFloat64ToFloat32(in []float64) (out []float32)

func Slice2D

func Slice2D(list []float64, size []int) [][]float64

Makes a 2D array from a contiguous 1D list

func Slice3D

func Slice3D(list []float64, size []int) [][][]float64

Makes a 3D array from a contiguous 1D list.

func Slice4D

func Slice4D(list []float64, size []int) [][][][]float64

Makes a 4D array from a contiguous 1D list.

Types

type Array

type Array struct {
	List           []float64       // Underlying contiguous storage
	Array          [][][][]float64 // Array in the usual way
	Comp           [][]float64     // Components as contiguous lists
	Size           [4]int          // INTERNAL {components, size0, size1, size2}
	Size4D         []int           // {components, size0, size1, size2}
	Size3D         []int           // {size0, size1, size2}
	SizeInElements int64           // The total number of elements in the array
	SizeInBytes    int64           // The total size of the array in bytes

	sync.RWMutex // mutex for safe concurrent access to this array
	// contains filtered or unexported fields
}

A MuMax Array represents a 3-dimensional array of N-vectors.

func NewArray

func NewArray(components int, size3D []int) *Array

Allocates an returns a new Array

func NewArrayFromList

func NewArrayFromList(components int, size3D []int, l []float64) *Array

Allocates an returns a new Array

func NewArrayPinned

func NewArrayPinned(components int, size3D []int) *Array

func (*Array) Component

func (a *Array) Component(component int) *Array

Component array, shares storage with original

func (*Array) Init

func (t *Array) Init(components int, size3D []int)

Initializes a pre-allocated Array struct

func (*Array) InitFromList

func (t *Array) InitFromList(components int, size3D []int, l []float64)

Initializes a pre-allocated Array struct

func (*Array) Len

func (a *Array) Len() int

func (*Array) NComp

func (a *Array) NComp() int

func (*Array) Pin

func (a *Array) Pin()

func (*Array) Rank

func (a *Array) Rank() int

func (*Array) WriteAscii

func (tens *Array) WriteAscii(out io.Writer)

func (*Array) WriteBinary

func (t *Array) WriteBinary(out io.Writer)

Jump to

Keyboard shortcuts

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