本文整理汇总了C#中SceneLibrary.MatrixFixed.Determinant方法的典型用法代码示例。如果您正苦于以下问题:C# MatrixFixed.Determinant方法的具体用法?C# MatrixFixed.Determinant怎么用?C# MatrixFixed.Determinant使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SceneLibrary.MatrixFixed
的用法示例。
在下文中一共展示了MatrixFixed.Determinant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Adjoint
//adjoint matrix / conjugate transpose
public MatrixFixed Adjoint()
{
if (this.Rows < 2 || this.Columns < 2)
throw new MatrixFixedException("Adjoint matrix not available");
MatrixFixed tempMtx = new MatrixFixed(this.Rows - 1, this.Columns - 1);
MatrixFixed adjMtx = new MatrixFixed(this.Columns, this.Rows);
for (int i = 0; i < this.Rows; i++)
{
for (int j = 0; j < this.Columns; j++)
{
tempMtx = this.Minor(i, j);
//put the determinent of the minor in the transposed position
adjMtx[j, i] = (int)Math.Pow(-1, i + j) * tempMtx.Determinant();
}
}
return adjMtx;
}
示例2: Determinant
//determinent
public float Determinant()
{
float determinent = 0;
if (this.Rows != this.Columns)
throw new MatrixFixedException("Attempt to find the determinent of a non square matrix");
//return 0;
//get the determinent of a 2x2 matrix
if (this.Rows == 2 && this.Columns == 2)
{
determinent = (m_matrix[0, 0] * m_matrix[1, 1]) - (m_matrix[0, 1] * m_matrix[1, 0]);
return determinent;
}
MatrixFixed tempMtx = new MatrixFixed(Rows - 1, Columns - 1);
//find the determinent with respect to the first row
for (int j = 0; j < this.Columns; j++)
{
tempMtx = this.Minor(0, j);
//recursively add the determinents
determinent += (int)Math.Pow(-1, j) * m_matrix[0, j] * tempMtx.Determinant();
}
return determinent;
}