本文整理汇总了C#中System.Matrix.GetDeterminant方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix.GetDeterminant方法的具体用法?C# Matrix.GetDeterminant怎么用?C# Matrix.GetDeterminant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Matrix
的用法示例。
在下文中一共展示了Matrix.GetDeterminant方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDeterminant
public void GetDeterminant()
{
matrix = new Matrix(1, 0, 0, 0, 0, 1, 2, 1, 0, 2, 1, 3, 0, 2, 1, 1);
Assert.AreEqual(6, matrix.GetDeterminant());
}
示例2: TestDeterminant4
public void TestDeterminant4()
{
var m = Matrix.GetIdentity(4);
Assert.AreEqual(1, m.GetDeterminant());
m.SetRow(0, 1, 0, 0, 0);
m.SetRow(1, 0, 1, 0, 0);
m.SetRow(2, 0, 0, 1, 0);
m.SetRow(3, 0, 0, 5, 0);
Assert.AreEqual(0, m.GetDeterminant());
m = new Matrix(new float[,]
{
{1, 2, 3, 4},
{8, 7, 6, 5},
{10, 9, 11, 12},
{14, 15, 13, 16}
});
Assert.AreEqual(-108, m.GetDeterminant());
}
示例3: TestDeterminant3
public void TestDeterminant3()
{
var m = Matrix.GetIdentity(3);
Assert.AreEqual(1, m.GetDeterminant());
m.SetRow(0, 1, 0, 0);
m.SetRow(1, 0, 1, 0);
m.SetRow(2, 0, 5, 0);
Assert.AreEqual(0, m.GetDeterminant());
m = new Matrix(new float[,]
{
{1, 2, 3},
{6, 5, 4},
{8, 7, 9}
});
Assert.AreEqual(1*5*9 + 2*4*8 + 3*7*6 - 8*5*3 - 7*4*1 - 9*2*6, m.GetDeterminant());
}
示例4: TestDeterminant2
public void TestDeterminant2()
{
var m = Matrix.GetIdentity(2);
Assert.AreEqual(1, m.GetDeterminant());
m.SetRow(0, 1, 0);
m.SetRow(1, 5, 0);
Assert.AreEqual(0, m.GetDeterminant());
m = new Matrix(new float[,]
{
{1, 2},
{4, 3}
});
Assert.AreEqual(1*3 - 2*4, m.GetDeterminant());
}
示例5: TestDeterminant1
public void TestDeterminant1()
{
var m = Matrix.GetIdentity(1);
Assert.AreEqual(1, m.GetDeterminant());
m.SetRow(0, 0);
Assert.AreEqual(0, m.GetDeterminant());
m = new Matrix(new float[,]
{
{2}
});
Assert.AreEqual(2, m.GetDeterminant());
}
示例6: TestDeterminant
public void TestDeterminant()
{
try
{
var m = new Matrix(3, 2);
m.GetDeterminant();
Assert.Fail("Expected an exception");
}
catch (ArgumentException) {}
try
{
var m = Matrix.GetIdentity(5);
m.GetDeterminant();
Assert.Fail("Expected an exception");
}
catch (NotImplementedException) {}
}