vec

package
v0.0.0-...-a6366f5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2018 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Vector

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

Vector is the vector struct

func Copy

func Copy(from Vector) Vector

Copy returns a copy of the given vector

func Init

func Init(nums ...float64) Vector

Init initializes a vector is the given numbers

func Make

func Make(size int) Vector

Make makes a vector of the given size

func Slice

func Slice(v Vector, from, to int) Vector

Slice returns a slice of vector [from, to)

func Sub

func Sub(v1, v2 Vector) Vector

Sub subtracts v1 from v2 and returns the result

func Unique

func Unique(v Vector) Vector

Unique returns a new vector containing only the unique elements of the given vector

func (Vector) Add

func (v Vector) Add(other Vector)

Add does the element wise addition with the given vector

func (Vector) AddScalar

func (v Vector) AddScalar(f float64)

AddScalar adds the given scalar to each element

func (*Vector) Append

func (v *Vector) Append(f float64)

Append appends the given float to the vector

func (Vector) At

func (v Vector) At(i int) float64

At returns the ith element

func (Vector) Contains

func (v Vector) Contains(f float64) bool

Contains returns whether or not the vector contains the given value

func (Vector) Exp

func (v Vector) Exp()

Exp applies the exponent function to each element

func (Vector) Index

func (v Vector) Index(value float64) int

Index returns the first index of the given float, otherwise -1

func (Vector) Indices

func (v Vector) Indices(value float64) []int

func (Vector) Len

func (v Vector) Len() int

Len returns length of the vector

func (Vector) Ln

func (v Vector) Ln()

Ln applies the natural logorithm to the receiver

func (Vector) Mul

func (v Vector) Mul(other Vector)

Mul does the element wise multiplication with the other vector

func (Vector) Pow

func (v Vector) Pow(f float64)

Pow applies the power function to each element with the given exponent

func (Vector) ReLU

func (v Vector) ReLU()

ReLU applies the ReLU activation function to the receiver

func (Vector) ReLUDer

func (v Vector) ReLUDer()

ReLUDer applies the ReLU derivative to the receiver

func (*Vector) Remove

func (v *Vector) Remove(index int)

func (Vector) Scale

func (v Vector) Scale(f float64)

Scale scales each element by the given float

func (Vector) Set

func (v Vector) Set(i int, f float64)

Set sets the ith element to the given float

func (Vector) SetData

func (v Vector) SetData(data []float64)

SetData replaces the data of the vector

func (Vector) Sigmoid

func (v Vector) Sigmoid()

Sigmoid applies the sigmoid activation function to the elements

func (Vector) SigmoidDer

func (v Vector) SigmoidDer()

SigmoidDer applies the sigmoid derivative function to the elements

func (Vector) Softmax

func (v Vector) Softmax()

func (Vector) String

func (v Vector) String() string

String returns a string representation of the Vector

func (Vector) Sub

func (v Vector) Sub(other Vector)

Sub does the element wise substactions with the given vector

func (Vector) Sum

func (v Vector) Sum() float64

Sum returns the sum of the elements

func (Vector) Swap

func (v Vector) Swap(i, j int)

Swap swaps the ith and jth elements

Jump to

Keyboard shortcuts

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