#include <cstdio>
#include <cstdlib>
int main(int argc, char *argv[])
{
try {
int device = argc > 1 ? atoi(argv[1]) : 0;
printf("Create a 5-by-3 matrix of random floats on the GPU\n");
printf("Element-wise arithmetic\n");
printf("Negate the first three elements of second column\n");
B(
seq(0, 2), 1) = B(
seq(0, 2), 1) * -1;
printf("Fourier transform the result\n");
printf("Grab last row\n");
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");
printf("Sort A and print sorted array and corresponding indices\n");
sort(vals, inds, A);
fprintf(stderr,
"%s\n", e.
what());
throw;
}
return 0;
}
A multi dimensional data container.
Definition array.h:27
Definition exception.h:20
virtual const char * what() const
Definition exception.h:34
seq is used to create seq for indexing af::array
Definition seq.h:46
@ f32
32-bit floating point values
Definition defines.h:196
@ afHost
Host pointer.
Definition defines.h:216
array::array_proxy col(int index)
Returns a reference to a col.
array::array_proxy row(int index)
Returns a reference to a row.
AFAPI void setDevice(const int device)
Sets the current device.
Definition algorithm.h:15
#define af_print(...)
Definition util.h:141