private void Button10_Click(Object sender, EventArgs e) { try { if (comboBox12.Text == Resources.res14) { var matrix = new Determinant <int>(Matrix <int> .GetLeftMatrix()); var determinant = matrix.Calculate(); MessageBox.Show(Resources.res13 + determinant.ToString() + '.', "Determinant"); } else { var matrix = new Determinant <double>(Matrix <double> .GetLeftMatrix()); var determinant = matrix.Calculate(); MessageBox.Show(Resources.res13 + determinant.ToString() + '.', "Determinant"); } } catch (NullReferenceException) { MessageBox.Show(Resources.res12, Resources.res03); } catch (MatrixLib.MatrixException exception) { MessageBox.Show(exception.Message, Resources.res03); } }
public void DeteminantOnesMatrix() { var a = Matrix <int> .CreateOnesMatrix(3, 3); var matr = new Determinant <int>(a); var detem = matr.Calculate(); Assert.AreEqual(1, detem); }
public void DeteminantException() { var matrOfArray = new double[, ] { { 0, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 }, { 7, 8, 9 } }; var a = new Matrix <double>(4, 3, matrOfArray); var dm = new Determinant <double>(a); Assert.ThrowsException <MatrixException>(() => dm.Calculate()); }
public void DeteminantUsersMatrix0() { var matrOfArray = new double[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; var a = new Matrix <double>(3, 3, matrOfArray); var matr = new Determinant <double>(a); var detem = matr.Calculate(); Assert.AreEqual(0, detem); }
public void DeteminantUsersMatrixNumb() { var matrOfArray = new int[, ] { { 0, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; var a = new Matrix <int>(3, 3, matrOfArray); var matr = new Determinant <int>(a); var detem = matr.Calculate(); Assert.AreEqual(3, detem); }