dalicious.math

Some additional mathematical functions.

Members

Classes

EdgeExistsException
class EdgeExistsException
Undocumented in source.
EmptySetException
class EmptySetException
Undocumented in source.
MissingEdgeException
class MissingEdgeException
Undocumented in source.
MissingNodeException
class MissingNodeException
Undocumented in source.
NodeExistsException
class NodeExistsException
Undocumented in source.

Enums

RoundingMode
enum RoundingMode
Undocumented in source.

Functions

N
auto N(Range values, Num totalSize)

Calculate the Nxx (e.g. N50) of values. values will be sorted in the process. If this is undesired the range must be duplicated beforehands. The elements of values are passed to map before calculating the median. This removes the necessity of creating a proxy range.

N
auto N(Range values, real xx, Num totalSize)
Undocumented in source. Be warned that the author may not have intended to support it.
absdiff
Num absdiff(Num a, Num b)

Returns the absolute difference between two numbers.

add
G.Edge add(G graph, G.Edge edge)

Add an edge to this graph and handle existing edges with handleConflict. The handler must have this signature Edge handleConflict(Edge, Edge).

bulkAdd
void bulkAdd(G graph, R edges)

Add a set of edges to this graph and merge mutli-edges using merge.

ceil
Integer ceil(Integer x, Integer base)

Round x upward according to base, ie. returns the next integer larger or equal to x which is divisible by base.

ceildiv
Integer ceildiv(Integer a, Integer b)

Returns the result of ceil(a / b) but uses integer arithmetic only.

eliminateOutliers
auto eliminateOutliers(R values, N lambda)
auto eliminateOutliers(R values, N lambda, M sampleMean)
auto eliminateOutliers(R values, N lambda, M sampleMean, S sampleStddev)
auto eliminateOutliers(R values, N lambda, M sampleMean, S sampleStddev, D sampleMedian)

Eliminate outliers the deviate more than expected from the sample median. A data point x is an outlier iff

filterEdges
void filterEdges(G graph)
Undocumented in source. Be warned that the author may not have intended to support it.
findAllCliques
auto findAllCliques(size_t[][] adjacencyList)

Find all maximal cliques in a graph represented by adjacencyList. The implementation is based on version 1 of the Bron-Kerbosch algorithm [1].

findCyclicSubgraphs
auto findCyclicSubgraphs(G graph, G.IncidentEdgesCache incidentEdgesCache)

Find a cycle base of an undirected graph using the Paton's algorithm.

findMaximallyConnectedComponents
auto findMaximallyConnectedComponents(size_t numNodes)

Find all maximal connected components of a graph-like structure. The predicate isConnected will be evaluated O(n^^2) times in the worst-case and Ω(n) in the best case. In expectation it will be evaluated θ(n*log(n)).

floor
Integer floor(Integer x, Integer base)

Round x downward according to base, ie. returns the next integer smaller or equal to x which is divisible by base.

histogram
Histogram!T histogram(T histMin, T histMax, T binSize)

Creates a histogram of values. Additional values can be inserted into the histogram using the insert method. The second form logHistogram creates a histogram with logarithmic bin sizes.

histogram
Histogram!T histogram(T histMin, T histMax, T binSize, R values)

Creates a histogram of values. Additional values can be inserted into the histogram using the insert method. The second form logHistogram creates a histogram with logarithmic bin sizes.

inverseLogIndex
size_t inverseLogIndex(size_t value, size_t base)

Compute a logarithmic index to base of value and vice versa. The function is piecewise linear for each interval of base indices. For interger values, the functions are mathematically equivalent to:

isInteger
bool isInteger(F x, F eps)
Undocumented in source. Be warned that the author may not have intended to support it.
isUndefined
bool isUndefined(T value)

Check if value has the standardized undefined value.

logHistogram
Histogram!(T, Yes.logIndex) logHistogram(T histMin, T histMax, size_t indexBase, R values)
Histogram!(T, Yes.logIndex) logHistogram(T histMin, T histMax, size_t indexBase)

Creates a histogram of values. Additional values can be inserted into the histogram using the insert method. The second form logHistogram creates a histogram with logarithmic bin sizes.

logIndex
size_t logIndex(size_t value, size_t base)

Compute a logarithmic index to base of value and vice versa. The function is piecewise linear for each interval of base indices. For interger values, the functions are mathematically equivalent to:

longestIncreasingSubsequence
auto longestIncreasingSubsequence(Range sequence)

Calculate a longest increasing subsequence of sequence. This subsequence is not necessarily contiguous, or unique. Given a sequence of n elements the algorithm uses O(n log n) evaluation of pred.

mapEdges
void mapEdges(G graph)
Undocumented in source. Be warned that the author may not have intended to support it.
mean
ElementType!Range mean(Range values)

Calculate the mean of range.

mean
double mean(Values values, Weights weights)

Calculate the weighted mean of values.

median
auto median(Range values)

Calculate the median of funed values. The elements of values are passed to fun before calculating the median. This removes the necessity of creating a proxy range.

quantiles
auto quantiles(Range values, F[] ps)

Calculate the quantiles of values mapped with fun. The elements of values are passed to fun before calculating the quantiles. This removes the necessity of creating a proxy range.

stddev
ElementType!Range stddev(Range values)
ElementType!Range stddev(Range values, M sampleMean)

Calculate the standard deviation (sigma^^2) of the sample.

Structs

Graph
struct Graph(Node, Weight = void, Flag!"isDirected" isDirected = No.isDirected, EdgePayload = void)

This structure represents a graph with optional edge payloads. The graph is represented as a list of edges which is particularly suited for sparse graphs. While the set of nodes is fixed the set of edges is mutable.

Histogram
struct Histogram(T, Flag!"logIndex" logIndex = No.logIndex)
Undocumented in source.
NaturalNumberSet
struct NaturalNumberSet
Undocumented in source.
UndirectedGraph
struct UndirectedGraph(Node, Weight = void)
Undocumented in source.

Templates

undefined
template undefined(T)

Standardized value that signifies undefined for all numeric types. It is NaN for floating point types and the maximum representable value for integer types.

Meta

License

Subject to the terms of the MIT license, as written in the included LICENSE file.

Authors

Arne Ludwig <arne.ludwig@posteo.de>