本文整理汇总了C#中IMatrix.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# IMatrix.Clone方法的具体用法?C# IMatrix.Clone怎么用?C# IMatrix.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMatrix
的用法示例。
在下文中一共展示了IMatrix.Clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Prepend
void Prepend(IMatrix matrix)
{
if (Current != null)
{
pop();
Current.Prepend(matrix);
}
else
{
Current = matrix.Clone();
}
push(Current);
}
示例2: Transform
public void Transform(IMatrix matrix)
{
if (matrix != null)
{
if (transform != null)
transform.Prepend(matrix);
else
transform = matrix.Clone();
}
else
transform = null;
control = null;
}
示例3: Solve
public IMatrix Solve(IMatrix rhs)
{
if (rhs.Rows != _l.Rows)
{
throw new ArgumentException("Matrix dimensions do not match.");
}
if (!_isSymmetric)
{
throw new InvalidOperationException("Matrix is not symmetric.");
}
if (!_isPositiveDefinite)
{
throw new InvalidOperationException("Matrix is not positive definite.");
}
int dimension = _l.Rows;
int count = rhs.Columns;
IMatrix b = rhs.Clone();
double[][] l = _l.Array;
// Solve L*Y = B;
for (int k = 0; k < _l.Rows; k++)
{
for (int i = k + 1; i < dimension; i++)
{
for (int j = 0; j < count; j++)
{
b[i, j] -= b[k, j]*l[i][k];
}
}
for (int j = 0; j < count; j++)
{
b[k, j] /= l[k][k];
}
}
// Solve L'*X = Y;
for (int k = dimension - 1; k >= 0; k--)
{
for (int j = 0; j < count; j++)
{
b[k, j] /= l[k][k];
}
for (int i = 0; i < k; i++)
{
for (int j = 0; j < count; j++)
{
b[i, j] -= b[k, j]*l[k][i];
}
}
}
return b;
}
示例4: Multiply
/// <summary>
/// Multiply the specified <paramref name="matrix"/> and <paramref name="matrices"/>.
/// </summary>
/// <returns>A new matrix with the product of multiplying each of the specified matrix and matrices</returns>
/// <param name="matrix">Matrix to multiply with</param>
/// <param name="matrices">Matrices to append</param>
public static IMatrix Multiply (IMatrix matrix, params IMatrix[] matrices)
{
matrix = matrix.Clone ();
for (int i = 0; i < matrices.Length; i++)
matrix.Append (matrices [i]);
return matrix;
}