18 #include "../include/Matrix.ipp"
19 #include "../include/MatrixAlgorithms.ipp"
20 #include "../include/Polynomial.ipp"
22 #include "gtest/gtest.h"
64 entryT tri =
trace(mi,5);
65 ASSERT_EQ(tri.size(),1);
66 ASSERT_DOUBLE_EQ(tri[0],3);
79 entryT tr2 =
trace(m2,3);
80 ASSERT_EQ(tr2,entryT(4185));
85 entryT p13 {0,0,2,0,0,0.1};
88 entryT p23 {0,100,0,23};
103 entryT tr =
trace(m,3);
104 ASSERT_EQ(tr,entryT ({9.0,70207.5000000000024,678.7500,29361.62500000000055,36300.0,3063.000000000000001,8590.0,135.0000000000000075}));
123 ASSERT_EQ(di,entryT(1));
137 ASSERT_EQ(d2,entryT(0));
142 entryT p13 {0,0,2,0,0,0.1};
145 entryT p23 {0,100,0,23};
160 ASSERT_EQ(d,entryT({0,23400.0,-90.0,-3642.99999999999982,0,-46028.5,-11.250,-10120.00}));
165 std::string input_file {
"test/inputs_MatDim5_PolyDegree5.csv"};
166 std::string result_file {
"test/result_MatDim5_PolyDegree5.csv"};
170 createMatrixWithPolynomialEntries<FieldT>(input_file,&M);
173 entryT expectedResultp= readPolynomialFromFile<FieldT>(result_file);
176 entryT resultp=
det(M);
177 ASSERT_EQ(resultp,expectedResultp);
182 std::string input_file {
"test/inputs_MatDim5_PolyDegree10.csv"};
183 std::string result_file {
"test/result_MatDim5_PolyDegree10.csv"};
187 createMatrixWithPolynomialEntries<FieldT>(input_file,&M);
190 entryT expectedResultp= readPolynomialFromFile<FieldT>(result_file);
193 entryT resultp=
det(M);
194 ASSERT_EQ(resultp,expectedResultp);
199 std::string input_file {
"test/inputs_MatDim10_PolyDegree10.csv"};
200 std::string result_file {
"test/result_MatDim10_PolyDegree10.csv"};
206 createMatrixWithPolynomialEntries<FieldT>(input_file,&M);
209 entryT expectedResultp= readPolynomialFromFile<FieldT>(result_file);
212 entryT resultp=
det(M);
213 ASSERT_EQ(resultp,expectedResultp);
217 int main(
int argc,
char **argv){
218 ::testing::InitGoogleTest(&argc,argv);
219 return RUN_ALL_TESTS();
int main(int argc, char **argv)
TEST_F(MatrixTest, determinant_large_10_10)
boost::numeric::ublas::matrix< EntryT > Matrix
Typedef for the main matrix class.
MatrixT::value_type det(const MatrixT &M)
Finds the determinant of a square matrix.
EntryT trace(const Matrix< EntryT > &M)
Finds trace of a square matrix.
Contains the definition for the abstract base class which will be used by different multiplication al...
Header for the utility functions like == operator for polynomials.