本文整理汇总了C#中ComplexDoubleMatrix.GetColumn方法的典型用法代码示例。如果您正苦于以下问题:C# ComplexDoubleMatrix.GetColumn方法的具体用法?C# ComplexDoubleMatrix.GetColumn怎么用?C# ComplexDoubleMatrix.GetColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComplexDoubleMatrix
的用法示例。
在下文中一共展示了ComplexDoubleMatrix.GetColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetColumnOutOfRange
public void GetColumnOutOfRange()
{
ComplexDoubleMatrix a = new ComplexDoubleMatrix(2, 2);
ComplexDoubleVector b = a.GetColumn(3);
}
示例2: 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] == Complex.Zero)
{
throw new SingularMatrixException("One of the leading sub-matrices is singular.");
}
// decompose matrix
int order = col.Length;
Complex[] A = new Complex[order];
Complex[] B = new Complex[order];
Complex[] Z = new Complex[order];
ComplexDoubleMatrix X = new ComplexDoubleMatrix(order);
Complex Q, S, Ke, Kr, e;
Complex Inner;
int i, j, l;
// setup the zero order solution
A[0] = Complex.One;
B[0] = Complex.One;
e = Complex.One / col[0];
X.SetRow(0, e * ComplexDoubleVector.GetRow(Y, 0));
for (i = 1; i < order; i++)
{
// calculate inner products
Q = Complex.Zero;
for (j = 0, l = 1; j < i; j++, l++)
{
Q += col[l] * A[j];
}
S = Complex.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] = Complex.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] = Complex.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 == Complex.One)
{
throw new SingularMatrixException("One of the leading sub-matrices is singular.");
}
// update diagonal
e = e / (Complex.One - Ke * Kr);
for (l = 0; l < Y.Rows; l++)
{
ComplexDoubleVector W = X.GetColumn(l);
ComplexDoubleVector M = ComplexDoubleVector.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;
}
示例3: GetColumn
public void GetColumn()
{
ComplexDoubleMatrix a = new ComplexDoubleMatrix(2, 2);
a[0, 0] = new Complex(1);
a[0, 1] = new Complex(2);
a[1, 0] = new Complex(3);
a[1, 1] = new Complex(4);
ComplexDoubleVector b = a.GetColumn(0);
Assert.AreEqual(b[0], a[0, 0]);
Assert.AreEqual(b[1], a[1, 0]);
}