mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-04-04 04:18:22 +00:00
LBC
This commit is contained in:
@@ -14,6 +14,11 @@ namespace Esiur.Analysis.Coding
|
||||
return frequencies.Sum(x => ((double)x / total * -Log2(x)));
|
||||
}
|
||||
|
||||
public static double AverageLength<T>(this CodeWord<T>[] words)
|
||||
{
|
||||
return words.Sum(x => x.Length) / (double)words.Length;
|
||||
}
|
||||
|
||||
public static double Log2(double value) => Math.Log10(value) / Math.Log10(2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user