本文整理汇总了C#中MathNet.Numerics.LinearAlgebra.Double.DenseVector.Sum方法的典型用法代码示例。如果您正苦于以下问题:C# DenseVector.Sum方法的具体用法?C# DenseVector.Sum怎么用?C# DenseVector.Sum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MathNet.Numerics.LinearAlgebra.Double.DenseVector
的用法示例。
在下文中一共展示了DenseVector.Sum方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateEigenVector
public void CalculateEigenVector()
{
var evd = JudgementMatrix.Evd();
var eigenVectors = evd.EigenVectors;
var eigenValues = evd.EigenValues;
DenseVector weight = new DenseVector(eigenValues.Count);
for (int i = 0; i < eigenValues.Count;i++ )
{
weight[i] = eigenValues[i].Real;
}
weight = weight / (weight.Sum());
WeightVector = weight;
maxEigenValue = WeightVector.AbsoluteMaximum();
if(WeightVector==null)
{
MessageBox.Show("判断矩阵错误,无法计算权重!");
}
}
示例2: Covariance
public static double Covariance(DenseVector x, DenseVector y)
{
var cov = new DenseVector(x.Count);
double xMean = x.Mean();
double yMean = y.Mean();
if (xMean.Equals(double.NaN) || yMean.Equals(double.NaN))
return double.NaN;
for (int i = 0; i < x.Count; i++)
{
cov[i] = (x[i] - xMean)*(y[i] - yMean);
}
return ((double) 1/(x.Count - 1))*cov.Sum();
}
示例3: Kurtosis
public static double Kurtosis(this double[] data)
{
var d = new DenseVector(data);
var num = new DenseVector(d.Count);
var denom = new DenseVector(d.Count);
d.CopyTo(num);
d.CopyTo(denom);
for (int i = 0; i < num.Count; i++)
{
num[i] = Math.Pow(d[i] - d.Mean(), 4);
denom[i] = Math.Pow(d[i] - d.Mean(), 2);
}
return (num.Sum()*num.Count)/(Math.Pow(denom.Sum(), 2));
}