Gapotchenko.FX.Math.Geometry 2022.2.7 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved

.NET 5.0 .NET Core 2.0 .NET Standard 2.0 .NET Framework 4.6
Install-Package Gapotchenko.FX.Math.Geometry -Version 2022.2.7
dotnet add package Gapotchenko.FX.Math.Geometry --version 2022.2.7
<PackageReference Include="Gapotchenko.FX.Math.Geometry" Version="2022.2.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Gapotchenko.FX.Math.Geometry --version 2022.2.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Gapotchenko.FX.Math.Geometry, 2022.2.7"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Gapotchenko.FX.Math.Geometry as a Cake Addin
#addin nuget:?package=Gapotchenko.FX.Math.Geometry&version=2022.2.7

// Install Gapotchenko.FX.Math.Geometry as a Cake Tool
#tool nuget:?package=Gapotchenko.FX.Math.Geometry&version=2022.2.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Overview

The module provides primitives and operations for geometry math.

StringMetrics

StringMetrics static class provides a variety of metric functions for measuring the distance between two strings of symbols.

The notion of a string is purely abstract. So it is not limited to just characters like System.String; it can be a string of anything in form of IEnumerable<T>. In this way, Gapotchenko.FX.Math.Geometry module achieves the right degree of abstraction desirable for a versatile math toolkit.

Edit Distance

Edit distance is a string metric reflecting the minimum number of operations required to transform one string into the other. There are several ways to measure the edit distance.

The table below compares edit distance measurement functions provided by StringMetrics class:

Metric Function Insertion Deletion Substitution Transposition
Levenshtein distance
Longest common subsequence (LCS) distance
Hamming distance
Damerau–Levenshtein distance
Optimal string alignment (OSA) distance
Jaro distance

Levenshtein Distance

StringMetrics.LevenshteinDistance method allows to calculate the Levenshtein distance between two strings of symbols.

Consider the example:

using Gapotchenko.FX.Math.Geometry;

int distance = StringMetrics.LevenshteinDistance("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance);  // distance = 2

Longest Common Subsequence (LCS) Distance

StringMetrics.LcsDistance method allows to calculate the longest common subsequence (LCS) distance between two strings of symbols.

Consider the example:

using Gapotchenko.FX.Math.Geometry;

int distance = StringMetrics.LcsDistance("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance);  // distance = 2

Hamming Distance

StringMetrics.HammingDistance method allows to calculate the Hamming distance between two strings of symbols.

Consider the example:

using Gapotchenko.FX.Math.Geometry;

int distance = StringMetrics.HammingDistance("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance);  // distance = 2

Damerau-Levenshtein Distance

StringMetrics.DamerauLevenshteinDistance method allows to calculate the Damerau–Levenshtein distance between two strings of symbols.

Consider the example:

using Gapotchenko.FX.Math.Geometry;

int distance = StringMetrics.DamerauLevenshteinDistance("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance);  // distance = 1

Optimal String Alignment (OSA) Distance

StringMetrics.OsaDistance method allows to calculate the optimal string alignment (OSA) distance between two strings of symbols.

Consider the example:

using Gapotchenko.FX.Math.Geometry;

int distance = StringMetrics.OsaDistance("ABC", "BAC");
Console.WriteLine("Distance is {0}.", distance);  // distance = 1

Jaro Distance

StringMetrics.JaroDistance method allows to calculate the Jaro distance between two strings of symbols.

Although the Jaro distance is often referred to as an edit distance metric, its value does not represent a number of edit operations and varies between 0 and 1 such that 0 is an exact match and 1 equates to no similarities.

Consider the example:

using Gapotchenko.FX.Math.Geometry;

double distance = StringMetrics.JaroDistance("ABC", "BAC");
Console.WriteLine("Distance is {0.00}.", distance);  // distance = 0.44

Commonly Used Types

  • Gapotchenko.FX.Math.Geometry.StringMetrics

Other Modules

Let's continue with a look at some other modules provided by Gapotchenko.FX:

Or look at the full list of modules.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2022.2.7 63 5/1/2022
2022.2.5 50 5/1/2022
2022.1.4 54 4/6/2022
2021.2.21 87 1/21/2022
2021.2.20 77 1/17/2022
2021.1.5 189 7/6/2021
2020.2.2-beta 262 11/21/2020