hashtron

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package Hashtron implements a hashtron (classifier)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hashtron

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

Hashtron represents individual hashtron (classifier) in memory

func New

func New(program [][2]uint32, bits byte, future ...interface{}) (h *Hashtron, err error)

New creates a new hashtron (giving pseudo random output), or initialized using a provided program and bits

func (Hashtron) Bits

func (h Hashtron) Bits() byte

Bits determines the number of output bits returned by hashtron using Forward

func (Hashtron) BytesBuffer

func (h Hashtron) BytesBuffer(name string, eol ...byte) (b *bytes.Buffer, err error)

BytesBuffer serializes hashtron into a golang code program

func (Hashtron) Forward

func (h Hashtron) Forward(sample uint32, negate bool) (out uint64)

Forward calculates the hashtron output on single feaure sample (32 bit uint)

func (Hashtron) Get

func (h Hashtron) Get(n int) (s uint32, max uint32)

Get gets the hashing command at position n

func (Hashtron) Len

func (h Hashtron) Len() int

Len gets the number of hashing commands (size of hashtron program)

func (*Hashtron) ReadJson added in v0.0.6

func (h *Hashtron) ReadJson(b io.Reader) error

ReadJson deserializes hashtron from a pre-xorred json io.Reader

func (Hashtron) SetBits added in v0.0.3

func (h Hashtron) SetBits(bits byte)

SetBits sets the number of output bits returned by hashtron using Forward

func (Hashtron) WriteJson added in v0.0.6

func (h Hashtron) WriteJson(b io.Writer, eol ...byte) error

WriteJson serializes hashtron into a pre-xorred json io.Writer

Jump to

Keyboard shortcuts

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