本文整理匯總了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;
}