本文整理汇总了C#中Complex32.Aggregate方法的典型用法代码示例。如果您正苦于以下问题:C# Complex32.Aggregate方法的具体用法?C# Complex32.Aggregate怎么用?C# Complex32.Aggregate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Complex32
的用法示例。
在下文中一共展示了Complex32.Aggregate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateColumn
/// <summary>
/// Generate column from initial matrix to work array
/// </summary>
/// <param name="a">Initial matrix</param>
/// <param name="row">The first row</param>
/// <param name="column">Column index</param>
/// <returns>Generated vector</returns>
static Complex32[] GenerateColumn(Matrix<Complex32> a, int row, int column)
{
var ru = a.RowCount - row;
var u = new Complex32[ru];
for (var i = row; i < a.RowCount; i++)
{
u[i - row] = a.At(i, column);
a.At(i, column, 0.0f);
}
var norm = u.Aggregate(Complex32.Zero, (current, t) => current + (t.Magnitude*t.Magnitude));
norm = norm.SquareRoot();
if (row == a.RowCount - 1 || norm.Magnitude == 0)
{
a.At(row, column, -u[0]);
u[0] = (float) Constants.Sqrt2;
return u;
}
if (u[0].Magnitude != 0.0f)
{
norm = norm.Magnitude*(u[0]/u[0].Magnitude);
}
a.At(row, column, -norm);
for (var i = 0; i < ru; i++)
{
u[i] /= norm;
}
u[0] += 1.0f;
var s = (1.0f/u[0]).SquareRoot();
for (var i = 0; i < ru; i++)
{
u[i] = u[i].Conjugate()*s;
}
return u;
}