double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow)&&(2 == MaxCol)){ return GetElement(1,1)*GetElement(2,2)- GetElement(1,2)*GetElement(2,1);} else{double ResultValue = 0;for(int c = 1;c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow)&&(2 == MaxCol)){
- return GetElement(1,1)*GetElement(2,2)- GetElement(1,2)*GetElement(2,1);}
else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);- else{double ResultValue = 0;for(int c = 1;c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow)&&(2 == MaxCol)){ return GetElement(1,1)*GetElement(2,2)- GetElement(1,2)*GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow)&&(2 == MaxCol)){
return GetElement(1,1)*GetElement(2,2)- GetElement(1,2)* GetElement(2,1);}- return GetElement(1,1)*GetElement(2,2)- GetElement(1,2)*GetElement(2,1);}
- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow)&&(2 == MaxCol)){ return GetElement(1,1)*GetElement(2,2)- GetElement(1,2)* GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow)&&(2 == MaxCol)){
return GetElement(1,1)*GetElement(2,2)- GetElement(1,2) * GetElement(2,1);}- return GetElement(1,1)*GetElement(2,2)- GetElement(1,2)* GetElement(2,1);}
- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow)&&(2 == MaxCol)){ return GetElement(1,1)*GetElement(2,2)- GetElement(1,2) * GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow)&&(2 == MaxCol)){
return GetElement(1,1)*GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}- return GetElement(1,1)*GetElement(2,2)- GetElement(1,2) * GetElement(2,1);}
- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow)&&(2 == MaxCol)){ return GetElement(1,1)*GetElement(2,2) - GetElement(1,2) * GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow)&&(2 == MaxCol)){
return GetElement(1,1)* GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}- return GetElement(1,1)*GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
double Matrix::GetValueOfDeterminant(){
if((2 == MaxRow)&&(2 == MaxCol)){
return GetElement(1,1)* GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
// TODO: Replace examples and use TDD development by writing your own tests
Describe(calculate_determinant)
{
It(calculating)
{
Assert::That(Test3_3Matrix.GetValueOfDeterminant(), Equals(Test3_3Matrix.Test()));
Assert::That(Test4_4Matrix.GetValueOfDeterminant(), Equals(Test4_4Matrix.Test()));
Assert::That(Test5_5Matrix.GetValueOfDeterminant(), Equals(Test5_5Matrix.Test()));
}
};
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow)&&(2 == MaxCol)){ return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
if((2 == MaxRow)&& (2 == MaxCol)){- if((2 == MaxRow)&&(2 == MaxCol)){
- return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow)&& (2 == MaxCol)){ return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
if((2 == MaxRow) && (2 == MaxCol)){- if((2 == MaxRow)&& (2 == MaxCol)){
- return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow) && (2 == MaxCol)){ return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow) && (2 == MaxCol)){
- return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow) && (2 == MaxCol)){ return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;} return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow) && (2 == MaxCol)){
- return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}
- return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow) && (2 == MaxCol)){ return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);} else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){ int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;} return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow) && (2 == MaxCol)){
- return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){- else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){
- int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}
- return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow) && (2 == MaxCol)){ return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);} else{double ResultValue = 0; for(int c = 1; c <= MaxCol; c++){ int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;} return ResultValue;}}
- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow) && (2 == MaxCol)){
- return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
else{double ResultValue = 0;- else{double ResultValue = 0;
- for(int c = 1; c <= MaxCol; c++){
- int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}
- return ResultValue;}}
double Matrix::GetValueOfDeterminant(){ if((2 == MaxRow) && (2 == MaxCol)){ return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);} else{ double ResultValue = 0; for(int c = 1; c <= MaxCol; c++){ int PowOfNegativeOne = std::pow(-1, c); ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;} return ResultValue;}}
//We have Matrix Matrix::GetCofactorMatrix() to return cofactor matrix//double & Matrix::GetElement(int _Row, int _Col) to return _Row and _Col of double element of matrixdouble Matrix::GetValueOfDeterminant(){if((2 == MaxRow) && (2 == MaxCol)){return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}else{double ResultValue = 0;for(int c = 1; c <= MaxCol; c++){int PowOfNegativeOne = std::pow(-1, c);ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}return ResultValue; }}- double Matrix::GetValueOfDeterminant(){
- if((2 == MaxRow) && (2 == MaxCol)){
- return GetElement(1,1) * GetElement(2,2) - GetElement(1,2) * GetElement(2,1);}
- else{
- double ResultValue = 0;
- for(int c = 1; c <= MaxCol; c++){
- int PowOfNegativeOne = std::pow(-1, c);
- ResultValue += GetCofactorMatrix(1,c).GetValueOfDeterminant() * GetElement(1,c) * PowOfNegativeOne;}
- return ResultValue;}}