/// @file /// Test poinwise muliplication of a pair of vectors /// \test Test poinwise muliplication of a pair of vectors #include #include int main(int argc, char **argv) { Ceed ceed; CeedVector x, y, w; CeedInt n; CeedScalar a[10]; const CeedScalar *b; CeedInit(argv[1], &ceed); n = 10; CeedVectorCreate(ceed, n, &x); CeedVectorCreate(ceed, n, &y); CeedVectorCreate(ceed, n, &w); for (CeedInt i=0; i 1e-14) // LCOV_EXCL_START printf("Error in w = x .* y, computed: %f actual: %f\n", b[i], 1.0*i*i); // LCOV_EXCL_STOP CeedVectorRestoreArrayRead(w, &b); // Test multiplying two vectors into one of the two CeedVectorPointwiseMult(w, w, y); CeedVectorGetArrayRead(w, CEED_MEM_HOST, &b); for (CeedInt i=0; i 1e-14) // LCOV_EXCL_START printf("Error in w = w .* y, computed: %f actual: %f\n", b[i], 1.0*i*i*i); // LCOV_EXCL_STOP CeedVectorRestoreArrayRead(w, &b); // Test multiplying two vectors into one of the two CeedVectorPointwiseMult(w, x, w); CeedVectorGetArrayRead(w, CEED_MEM_HOST, &b); for (CeedInt i=0; i 1e-14) // LCOV_EXCL_START printf("Error in w = x .* w, computed: %f actual: %f\n", b[i], 1.0*i*i*i*i); // LCOV_EXCL_STOP CeedVectorRestoreArrayRead(w, &b); // Test multiplying vector by itself and putting product into self CeedVectorPointwiseMult(y, y, y); CeedVectorGetArrayRead(y, CEED_MEM_HOST, &b); for (CeedInt i=0; i 1e-14) // LCOV_EXCL_START printf("Error in y = y .* y, computed: %f actual: %f\n", b[i], 1.0*i*i); // LCOV_EXCL_STOP CeedVectorRestoreArrayRead(y, &b); CeedVectorDestroy(&x); CeedVectorDestroy(&y); CeedVectorDestroy(&w); CeedDestroy(&ceed); return 0; }