#include <stdio.h>
using namespace af;
int main(int argc, char **argv)
{
try {
int device = argc > 1 ? atoi(argv[1]) : 0;
printf("\ncreate a 5-by-3 matrix of random floats on the GPU\n");
printf("element-wise arithmetic\n");
printf("Fourier transform the result\n");
printf("grab last row\n");
printf("zero out every other column\n");
printf("negate the first three elements of middle column\n");
B(
seq(3), 1) = B(
seq(3), 1) * -1;
printf("create 2-by-3 matrix from host data\n");
float d[] = { 1, 2, 3, 4, 5, 6 };
printf("copy last column onto first\n");
float* d_ = D.
host<
float>();
fprintf(stderr,
"%s\n", e.
what());
throw;
}
#ifdef WIN32 // pause in Windows
if (!(argc == 2 && argv[1][0] == '-')) {
printf("hit [enter]...");
fflush(stdout);
getchar();
}
#endif
return 0;
}