Module mathlib

Math utility functions.

Copyright © 2007-2014 Zuse Institute Berlin

Version: $Id$

Authors: Marie Hoffmann (ozymandiaz147@googlemail.com).

Description

Math utility functions.

Data Types

vector()

vector() = [number(), ...]

Function Index

aggloClustering/2Get closest centroids and merge them if their distance is within Radius.
binomial_coeff/2Calculates the binomial coefficient of n over k for n >= k.
binomial_coeff_feeder/2
closestPoints/1Find indices of closest centroids.
euclideanDistance/1Euclidean distance between origin and V.
euclideanDistance/2Euclidean distance between two vectors.
factorial/1calculates N!
factorial_feeder/1
gcd/2Calculates the greatest common divisor of two integers.
median/1Median of an unsorted non-empty list of numbers, i.e.
nearestCentroid/2Get the nearest centroid to U from the list Centroids, including the euclidian distance.
u/1Unit vector u(v) = v/||v||.
vecAdd/2Add two vectors X,Y, i.e.
vecMult/2Multiply vector V with a scalar S.
vecSub/2Substract two vectors X,Y, i.e.
vecWeightedAvg/4
zeros/1Create a list with N zeros.
zeros_feeder/1

Function Details

median/1

median(L :: vector()) -> number()

Median of an unsorted non-empty list of numbers, i.e. a vector.

vecAdd/2

vecAdd(X :: vector(), Y :: vector()) -> vector()

Add two vectors X,Y, i.e. X + Y.

vecSub/2

vecSub(X :: vector(), Y :: vector()) -> vector()

Substract two vectors X,Y, i.e. X - Y.

vecMult/2

vecMult(V :: vector(), S :: float()) -> vector()

Multiply vector V with a scalar S.

vecWeightedAvg/4

vecWeightedAvg(V1 :: vector(),
               V2 :: vector(),
               W1 :: float(),
               W2 :: float()) ->
                  vector()

euclideanDistance/1

euclideanDistance(V :: vector()) -> Distance :: float()

Euclidean distance between origin and V.

euclideanDistance/2

euclideanDistance(V :: vector(), W :: vector()) ->
                     Distance :: float()

Euclidean distance between two vectors.

u/1

u(V :: vector()) -> UV :: vector()

Unit vector u(v) = v/||v||

nearestCentroid/2

nearestCentroid(U :: dc_centroids:centroid(),
                T :: dc_centroids:centroids()) ->
                   {Distance :: float(),
                    NearestCentroid :: dc_centroids:centroid()} |
                   none

Get the nearest centroid to U from the list Centroids, including the euclidian distance. The function returns 'none' if no nearest centroid can be found. Ambiguity is resolved by picking the first one of the nearest centroids.

closestPoints/1

closestPoints(Centroids :: dc_centroids:centroids()) ->
                 {dc_centroids:centroid(),
                  dc_centroids:centroid()} |
                 none

Find indices of closest centroids.

zeros_feeder/1

zeros_feeder(N :: 0..10000) -> {0..10000}

zeros/1

zeros(N :: 0) -> []

Create a list with N zeros.

aggloClustering/2

aggloClustering(Centroids :: dc_centroids:centroids(),
                Radius :: number()) ->
                   dc_centroids:centroids()

Get closest centroids and merge them if their distance is within Radius.

binomial_coeff/2

binomial_coeff(N :: non_neg_integer(), K :: non_neg_integer()) ->
                  integer()

Calculates the binomial coefficient of n over k for n >= k. see http://rosettacode.org/wiki/Evaluate_binomial_coefficients#Erlang

binomial_coeff_feeder/2

binomial_coeff_feeder(X :: 0..100, Y :: 0..100) ->
                         {non_neg_integer(), non_neg_integer()}

factorial_feeder/1

factorial_feeder(N :: 0..20) -> {0..20}

factorial/1

factorial(N :: non_neg_integer()) -> pos_integer()

calculates N!

gcd/2

gcd(A :: non_neg_integer(), B :: non_neg_integer()) ->
       non_neg_integer()

Calculates the greatest common divisor of two integers.


Generated by EDoc, Sep 11 2020, 15:24:39.