本文整理汇总了C#中DenseVector.Conjugate方法的典型用法代码示例。如果您正苦于以下问题:C# DenseVector.Conjugate方法的具体用法?C# DenseVector.Conjugate怎么用?C# DenseVector.Conjugate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DenseVector
的用法示例。
在下文中一共展示了DenseVector.Conjugate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Solve
//.........这里部分代码省略.........
var temp = new DenseVector(input.Count);
var temp1 = new DenseVector(input.Count);
var temp2 = new DenseVector(input.Count);
// Initialize
var startNorm = input.Norm(2);
// Define the scalars
Complex32 alpha = 0;
Complex32 eta = 0;
float theta = 0;
var tau = startNorm.Real;
Complex32 rho = tau * tau;
// Calculate the initial values for v
// M temp = yEven
_preconditioner.Approximate(yeven, temp);
// v = A temp
matrix.Multiply(temp, v);
// Set uOdd
v.CopyTo(ueven);
// Start the iteration
var iterationNumber = 0;
while (ShouldContinue(iterationNumber, result, input, pseudoResiduals))
{
// First part of the step, the even bit
if (IsEven(iterationNumber))
{
// sigma = (v, r)
var sigma = v.DotProduct(r.Conjugate());
if (sigma.Real.AlmostEqual(0, 1) && sigma.Imaginary.AlmostEqual(0, 1))
{
// FAIL HERE
_iterator.IterationCancelled();
break;
}
// alpha = rho / sigma
alpha = rho / sigma;
// yOdd = yEven - alpha * v
v.Multiply(-alpha, temp1);
yeven.Add(temp1, yodd);
// Solve M temp = yOdd
_preconditioner.Approximate(yodd, temp);
// uOdd = A temp
matrix.Multiply(temp, uodd);
}
// The intermediate step which is equal for both even and
// odd iteration steps.
// Select the correct vector
var uinternal = IsEven(iterationNumber) ? ueven : uodd;
var yinternal = IsEven(iterationNumber) ? yeven : yodd;
// pseudoResiduals = pseudoResiduals - alpha * uOdd
uinternal.Multiply(-alpha, temp1);
pseudoResiduals.Add(temp1, temp2);
temp2.CopyTo(pseudoResiduals);