/// @file /// Test Simultaneous Diagonalization /// \test Simultaneous Diagonalization #include #include int main(int argc, char **argv) { Ceed ceed; CeedInt P = 4, Q = 4; CeedScalar M[P*P], K[P*P], X[P*P], lambda[P]; CeedBasis basis; CeedInit(argv[1], &ceed); // Create mass, stiffness matrix CeedBasisCreateTensorH1Lagrange(ceed, 1, 1, P, Q, CEED_GAUSS, &basis); const CeedScalar *interp, *grad, *quad_weights; CeedBasisGetInterp(basis, &interp); CeedBasisGetGrad(basis, &grad); CeedBasisGetQWeights(basis, &quad_weights); for (int i=0; i 100.*CEED_EPSILON) // LCOV_EXCL_START printf("Error in diagonalization of M [%d, %d]: %f != %f\n", i, j, M[P*i+j], (i == j ? 1.0 : 0.0)); // LCOV_EXCL_STOP // Check X^T K X = Lamda for (int i=0; i 100.*CEED_EPSILON) // LCOV_EXCL_START printf("Error in diagonalization of K [%d, %d]: %f != %f\n", i, j, K[P*i+j], (i == j ? lambda[i] : 0.0)); // LCOV_EXCL_STOP CeedBasisDestroy(&basis); CeedDestroy(&ceed); return 0; }