ArrayFire: lin_algebra/cholesky.cpp (original) (raw)

#include

#include

using namespace af;

int main(int argc, char* argv[]) {

try {

int device = argc > 1 ? atoi(argv[1]) : 0;

int n = 5;

array t = randu(n, n);

array in = matmulNT(t, t) + identity(n, n) * n;

printf("Running Cholesky InPlace\n");

choleskyInPlace(cin_upper, true);

choleskyInPlace(cin_lower, false);

printf("Running Cholesky Out of place\n");

cholesky(out_upper, in, true);

cholesky(out_lower, in, false);

fprintf(stderr, "%s\n", e.what());

throw;

}

return 0;

}

A multi dimensional data container.

array copy() const

Perform deep copy of the array.

An ArrayFire exception class.

virtual const char * what() const

Returns an error message for the exception in a string format.

AFAPI void setDevice(const int device)

Sets the current device.