goDistances

package module
v0.0.0-...-7146cc9 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: LGPL-3.0 Imports: 5 Imported by: 1

README

Build Status GoDoc

GoDistances

GoDistances is a library for calculating different kind of distance between n-dimensional vectors. This code has been highly influenced by Bugra Akyildiz' kmeans project https://github.com/bugra/kmeans.

This lib comes with this distances calculations:

Documentation

GoDoc

License

BSD License Issues

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrayCurtisDistance

type BrayCurtisDistance struct{}

BrayCurtisDistance calculates a Bray Curtis distance. see http://people.revoledu.com/kardi/tutorial/Similarity/BrayCurtisDistance.html http://www.wolframalpha.com/input/?i=Bray+Curtis+Distance

func (BrayCurtisDistance) Distance

func (bcd BrayCurtisDistance) Distance(params ...interface{}) (float64, error)

Distance takes two float slices as vectors and returns a float as the distance between the two vectors.

type CanberraDistance

type CanberraDistance struct{}

CanberraDistance calculates a canberra distance. see http://en.wikipedia.org/wiki/Canberra_distance see http://reference.wolfram.com/language/ref/CanberraDistance.html

func (CanberraDistance) Distance

func (cd CanberraDistance) Distance(params ...interface{}) (float64, error)

Distance takes two float64 slices which have to have the same size. It will return a float for the distance between the two slices.

type ChebyshevDistance

type ChebyshevDistance struct{}

ChebyshevDistance calculates a Chebyshev distance http://en.wikipedia.org/wiki/Chebyshev_distance http://reference.wolfram.com/language/ref/ChessboardDistance.html

func (ChebyshevDistance) Distance

func (cd ChebyshevDistance) Distance(params ...interface{}) (float64, error)

Distance takes two float64 slices which have to have the same size. It will return a float for the distance between the two slices.

type Distancer

type Distancer interface {
	Distance(params ...interface{}) (float64, error)
}

Distancer Interface takes n-parameters, the implementation has to take care that the parameters are valid.

type EuclideanDistance

type EuclideanDistance struct{}

EuclideanDistance calculates an euclidean distance http://en.wikipedia.org/wiki/Euclidean_distance

func (EuclideanDistance) Distance

func (e2d EuclideanDistance) Distance(params ...interface{}) (float64, error)

Distance takes two float64 slices which have to have the same size. It will return a float for the distance between the two slices.

type EuclideanDistanceSquare

type EuclideanDistanceSquare struct{}

EuclideanDistanceSquare calculates an euclidean distance and square the result It will return a float for the distance between the two slices.

func (EuclideanDistanceSquare) Distance

func (e2d EuclideanDistanceSquare) Distance(params ...interface{}) (float64, error)

Distance takes two float64 slices which have to have the same size.

type GeoCoordinate

type GeoCoordinate struct {
	Degree            float64
	Minutes           float64
	Seconds           float64
	CardinalDirection string // (n)orth,(s)outh, (e)ast or (w)est
}

func (*GeoCoordinate) ParseDMS

func (gC *GeoCoordinate) ParseDMS(dms string) error

func (*GeoCoordinate) ParseDecimal

func (gC *GeoCoordinate) ParseDecimal(d float64) error

func (*GeoCoordinate) ParseDecimalAsLatitude

func (gC *GeoCoordinate) ParseDecimalAsLatitude(d float64) error

func (*GeoCoordinate) ParseDecimalAsLongitude

func (gC *GeoCoordinate) ParseDecimalAsLongitude(d float64) error

func (*GeoCoordinate) ToDMS

func (gC *GeoCoordinate) ToDMS() string

func (GeoCoordinate) ToDecimal

func (gC GeoCoordinate) ToDecimal() float64

func (GeoCoordinate) ToRad

func (gC GeoCoordinate) ToRad() float64

type GeoDistance

type GeoDistance struct{}

GeoDistance calculates the distance

func (GeoDistance) Distance

func (mG GeoDistance) Distance(params ...interface{}) (float64, error)

http://en.wikipedia.org/wiki/Vincenty%27s_formulae

type GeoPoint

type GeoPoint struct {
	Latitude  GeoCoordinate
	Longitude GeoCoordinate
}

type HammingDistance

type HammingDistance struct{}

HammingDistance calculates the hamming distance

func (HammingDistance) Distance

func (hd HammingDistance) Distance(params ...interface{}) (float64, error)

Distance takes two float64 slices which have to have the same size. It will return a float for the distance between the two slices.

type LpNormDistance

type LpNormDistance struct{}

LpNormDistance norm distance

func (LpNormDistance) Distance

func (e2d LpNormDistance) Distance(params ...interface{}) (float64, error)

Distance takes one float64 slices and one float64 value. It will return a float for the distance between the two values.

type ManhattanDistance

type ManhattanDistance struct{}

ManhattanDistance calculates the manhattan distance

func (ManhattanDistance) Distance

func (mD ManhattanDistance) Distance(params ...interface{}) (float64, error)

Distance takes two float64 slices which have to have the same size. It will return a float for the distance between the two slices.

type MinkowskiDistance

type MinkowskiDistance struct{}

MinkowskiDistance calculates the Minkowski distance

func (MinkowskiDistance) Distance

func (md MinkowskiDistance) Distance(params ...interface{}) (float64, error)

Distance takes two float64 slices which have to have the same size and a float64 value. It will return a float for the distance between the two slices.

type MinkowskiDistanceWeighted

type MinkowskiDistanceWeighted struct{}

MinkowskiDistanceWeighted calculates the Minkowski distance uses a weight slice

func (MinkowskiDistanceWeighted) Distance

func (mwd MinkowskiDistanceWeighted) Distance(params ...interface{}) (float64, error)

Distance takes three float64 slices which have to have the same size. The first two slices are the vectors and the third slice is the weight table. The forth parameter is a float64 value. It will return a float for the distance between the two slices.

Jump to

Keyboard shortcuts

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