2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 13:33:13 +00:00
This commit is contained in:
2022-10-30 18:43:45 +03:00
parent 584cd458de
commit e83f51f952
5 changed files with 46 additions and 18 deletions

View File

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
@ -48,12 +49,26 @@ namespace Esiur.Analysis.Fuzzy
public KeyValuePair<double, double>[] Maximas
{
get {
get
{
var max = vector.Values.Max();
return vector.Where(x => x.Value == max).ToArray();
}
}
public double Integral(double from, double to)
{
return vector.Where(x => x.Key >= from && x.Key <= to).Sum(x => x.Value);
}
public double Centroid(double from, double to)
{
var r = vector.Where(x => x.Key >= from && x.Key <= to).ToArray();
return r.Sum(x => x.Key * x.Value ) / r.Sum(x=>x.Value);
}
public KeyValuePair<double, double>[] Minimas
{
get
@ -63,5 +78,6 @@ namespace Esiur.Analysis.Fuzzy
}
}
}
}