vektor

package
v0.0.0-...-f38051e Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Package vektor isolates the mysteries of Swap for further investigation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Vektor

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

Vektor implements the Gridder interface in the c stlyle as seen in stam https://www.josstam.com/_files/ugd/cf1fd6_9989229efbd34a26ba5ccd913721a2ac.pdf

Basically a 1D vector stores the 2D values and two grid coordinates are translated to a single index

Perhaps the golang offers more performant or idomatic approaches - multi dimension slice, prolly better? - array (sans slice), doubtful? In the meantime, we have some isolation via the interface

func New

func New(dim int) *Vektor

New creates a vektor, given:

dim: width and height of grid

func (*Vektor) Get

func (vk *Vektor) Get(i, j int) float64

Get gets the value for a given cell

func (*Vektor) Set

func (vk *Vektor) Set(i, j int, val float64)

Set sets a value for the given cell

func (*Vektor) Swap

func (vk *Vektor) Swap(other ifc.Gridder)

Swap swaps the value slices of two vektors for this to work: - pass in pointers to the vektors (of course) - respective vektors hold pointers to value slices "type vektorAlt []float64" with swapping in layer could be cleaner? Todo: yes!

Jump to

Keyboard shortcuts

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