1 #include <gtest/gtest.h> 67 VectorNd myvector_10 = VectorNd::Constant((
size_t) 10, 12.);
69 double *test_values =
new double[10];
70 for (
unsigned int i = 0; i < 10; i++)
75 for(
int i = 0;i<myvector_10.rows();i++)
77 EXPECT_EQ(myvector_10(i),test_values[i]);
85 MatrixNd mymatrix_10x10 = MatrixNd::Constant(10, 10, 12.);
87 double *test_values =
new double[10 * 10];
88 for (
unsigned int i = 0; i < 10; i++)
90 for (
unsigned int j = 0; j < 10; j++)
92 test_values[i * 10 + j] = 12.;
96 for(
int i = 0;i<mymatrix_10x10.rows();i++)
98 for(
int j = 0;j<mymatrix_10x10.cols();j++)
100 EXPECT_EQ(test_values[i*10+j],mymatrix_10x10(i,j));
105 delete[] test_values;
111 1., 2., 3., 4., 5., 6.,
112 11., 12., 13., 14., 15., 16.,
113 21., 22., 23., 24., 25., 26.,
114 31., 32., 33., 34., 35., 36.,
115 41., 42., 43., 44., 45., 46.,
116 51., 52., 53., 54., 55., 56.
124 1442, 1484, 1526, 1568, 1610, 1652,
125 4562, 4724, 4886, 5048, 5210, 5372,
126 7682, 7964, 8246, 8528, 8810, 9092,
127 10802, 11204, 11606, 12008, 12410, 12812,
128 13922, 14444, 14966, 15488, 16010, 16532,
129 17042, 17684, 18326, 18968, 19610, 20252
143 int main(
int argc,
char **argv)
145 ::testing::InitGoogleTest(&argc, argv);
146 return RUN_ALL_TESTS();
static bool checkVectorNdEpsilonClose(const RobotDynamics::Math::VectorNd &v1, const RobotDynamics::Math::VectorNd &v2, const double epsilon)
int main(int argc, char **argv)
bool linSolveGaussElimPivot(MatrixNd A, VectorNd b, VectorNd &x)
Solves a linear system using gaussian elimination with pivoting.
static bool checkSpatialMatrixEpsilonClose(const RobotDynamics::Math::SpatialMatrix &t1, const RobotDynamics::Math::SpatialMatrix &t2, const double epsilon)
TEST(MathFixture, GaussElimPivot)
Math types such as vectors and matrices and utility functions.