Gapotchenko.FX.Math.Geometry 2022.2.7

Prefix Reserved
Suggested Alternatives

Gapotchenko.FX.Math.Metrics

Additional Details

Gapotchenko.FX.Math.Geometry package was formalized, improved, and refactored into Gapotchenko.FX.Math.Metrics package. Consider using Gapotchenko.FX.Math.Metrics package for all new developments.

dotnet add package Gapotchenko.FX.Math.Geometry --version 2022.2.7                
NuGet\Install-Package Gapotchenko.FX.Math.Geometry -Version 2022.2.7                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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                
#r "nuget: Gapotchenko.FX.Math.Geometry, 2022.2.7"                
#r directive can be used in F# Interactive and Polyglot Notebooks. 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                

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 Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 is compatible.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 is compatible.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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.