本文整理汇总了C#中MathNet.Numerics.LinearAlgebra.Double.DenseVector.Min方法的典型用法代码示例。如果您正苦于以下问题:C# DenseVector.Min方法的具体用法?C# DenseVector.Min怎么用?C# DenseVector.Min使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MathNet.Numerics.LinearAlgebra.Double.DenseVector
的用法示例。
在下文中一共展示了DenseVector.Min方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Normalize0to1
public static DenseVector Normalize0to1(this DenseVector data)
{
var d = new DenseVector(data);
var result = new DenseVector(d.Count);
d.CopyTo(result);
return (DenseVector) (result - d.Min())/(d.Max() - d.Min());
}
示例2: NormalizeNeg1to1
public static double[] NormalizeNeg1to1(this double[] data)
{
var d = new DenseVector(data);
var result = new DenseVector(d.Count);
d.CopyTo(result);
result = (DenseVector) (result - ((d.Max() + d.Min())/2))/((d.Max() - d.Min())/2);
return result.ToArray();
}
示例3: ModificatedDualIteration
//.........这里部分代码省略.........
var nk = kappaValue < _task.dLower[kappaIndex] ? 1 : -1;
var deltaYT =
nk * DenseVector.Create(_task.Jb.Count, i => i == _task.Jb.ToList().IndexOf(kappaIndex) ? 1 : 0)
* DenseMatrix.OfColumnVectors(vectorCollection.ToArray()).Inverse();
var nVector = new DenseVector(_task.A.ColumnCount);
for (int i = 0; i < _task.A.ColumnCount; i++)
{
if (!_task.Jb.Contains(i))
{
nVector[i] = (deltaYT * _task.A.Column(i));
}
}
// Step6
Vector<double> sigmaVector = new DenseVector(_task.A.ColumnCount);
for (int i = 0; i < sigmaVector.Count; i++)
{
if (_task.dLower[i] == _task.dUpper[i])
{
sigmaVector[i] = double.PositiveInfinity;
}
else if (_JNbUpper.Contains(i) && nVector[i] < Eps)
{
sigmaVector[i] = -deltas[i] / nVector[i];
}
else if (_JNbLower.Contains(i) && nVector[i] > Eps)
{
sigmaVector[i] = -deltas[i] / nVector[i];
}
else
{
sigmaVector[i] = double.PositiveInfinity;
}
}
var sigma0 = sigmaVector.Min();
var sigma0Index = sigmaVector.MinimumIndex();
// Step7
if (sigma0 == double.PositiveInfinity)
{
//Logger.Log("Stopped at seventh step");
_stopStep = 7;
return false;
}
// Step8
Vector<double> newDeltas = new DenseVector(_task.A.ColumnCount);
for (int i = 0; i < newDeltas.Count; i++)
{
if (_task.Jb.Contains(i) && i != kappaIndex)
{
newDeltas[i] = 0;
}
else if (i == kappaIndex)
{
newDeltas[i] = sigma0 * nk;
}
else
{
newDeltas[i] = deltas[i] + sigma0 * nVector[i];
}
}
deltas = newDeltas.ToList();
// Step9
_task.Jb[_task.Jb.ToList().IndexOf(kappaIndex)] = sigma0Index;
// Step10
if (nk == 1.0)
{
if (_JNbUpper.Contains(sigma0Index))
{
_JNbUpper[_JNbUpper.IndexOf(sigma0Index)] = kappaIndex;
}
else
{
_JNbUpper.Add(kappaIndex);
}
}
else if (nk == -1.0)
{
if (_JNbUpper.Contains(sigma0Index))
{
_JNbUpper.Remove(sigma0Index);
}
}
_JNbLower.Clear();
for (int i = 0; i < _task.A.ColumnCount; i++)
{
if (!_JNbUpper.Contains(i) && !_task.Jb.Contains(i))
{
_JNbLower.Add(i);
}
}
return true;
}