本文整理汇总了C#中ComplexFloatMatrix.GetColumn方法的典型用法代码示例。如果您正苦于以下问题:C# ComplexFloatMatrix.GetColumn方法的具体用法?C# ComplexFloatMatrix.GetColumn怎么用?C# ComplexFloatMatrix.GetColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComplexFloatMatrix
的用法示例。
在下文中一共展示了ComplexFloatMatrix.GetColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetColumn
public void GetColumn()
{
ComplexFloatMatrix a = new ComplexFloatMatrix(2,2);
a[0,0] = new ComplexFloat(1);
a[0,1] = new ComplexFloat(2);
a[1,0] = new ComplexFloat(3);
a[1,1] = new ComplexFloat(4);
ComplexFloatVector b = a.GetColumn(0);
Assert.AreEqual(b[0], a[0,0]);
Assert.AreEqual(b[1], a[1,0]);
}
示例2: GetColumnOutOfRange
public void GetColumnOutOfRange()
{
ComplexFloatMatrix a = new ComplexFloatMatrix(2,2);
ComplexFloatVector b = a.GetColumn(3);
}
示例3: Solve
//.........这里部分代码省略.........
throw new RankException("The numer of rows in Y does not match the length of col and row.");
}
// check if leading diagonal is zero
if (col[0] == ComplexFloat.Zero)
{
throw new SingularMatrixException("One of the leading sub-matrices is singular.");
}
// decompose matrix
int order = col.Length;
ComplexFloat[] A = new ComplexFloat[order];
ComplexFloat[] B = new ComplexFloat[order];
ComplexFloat[] Z = new ComplexFloat[order];
ComplexFloatMatrix X = new ComplexFloatMatrix(order);
ComplexFloat Q, S, Ke, Kr, e;
ComplexFloat Inner;
int i, j, l;
// setup the zero order solution
A[0] = ComplexFloat.One;
B[0] = ComplexFloat.One;
e = ComplexFloat.One / col[0];
X.SetRow(0, e * ComplexFloatVector.GetRow(Y, 0));
for (i = 1; i < order; i++)
{
// calculate inner products
Q = ComplexFloat.Zero;
for (j = 0, l = 1; j < i; j++, l++)
{
Q += col[l] * A[j];
}
S = ComplexFloat.Zero;
for (j = 0, l = 1; j < i; j++, l++)
{
S += row[l] * B[j];
}
// reflection coefficients
Kr = -S * e;
Ke = -Q * e;
// update lower triangle (in temporary storage)
Z[0] = ComplexFloat.Zero;
Array.Copy(A, 0, Z, 1, i);
for (j = 0, l = i - 1; j < i; j++, l--)
{
Z[j] += Ke * B[l];
}
// update upper triangle
for (j = i; j > 0; j--)
{
B[j] = B[j - 1];
}
B[0] = ComplexFloat.Zero;
for (j = 0, l = i - 1; j < i; j++, l--)
{
B[j] += Kr * A[l];
}
// copy from temporary storage to lower triangle
Array.Copy(Z, 0, A, 0, i + 1);
// check for singular sub-matrix)
if (Ke * Kr == ComplexFloat.One)
{
throw new SingularMatrixException("One of the leading sub-matrices is singular.");
}
// update diagonal
e = e / (ComplexFloat.One - Ke * Kr);
for (l = 0; l < Y.Rows; l++)
{
ComplexFloatVector W = X.GetColumn(l);
ComplexFloatVector M = ComplexFloatVector.GetColumn(Y, l);
Inner = M[i];
for (j = 0; j < i; j++)
{
Inner += A[j] * M[j];
}
Inner *= e;
W[i] = Inner;
for (j = 0; j < i; j++)
{
W[j] += Inner * B[j];
}
X.SetColumn(l, W);
}
}
return X;
}