A high-performance general-purpose compute library
* Copyright (c) 2014, ArrayFire
* All rights reserved.
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
#include <arrayfire.h>
#include <cstdio>
#include <cstdlib>
using namespace af;
int main(int argc, char* argv[]) {
try {
// Select a device and display arrayfire info
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");
array cin_upper = in.copy();
array cin_lower = in.copy();
choleskyInPlace(cin_upper, true);
choleskyInPlace(cin_lower, false);
printf("Running Cholesky Out of place\n");
array out_upper;
array out_lower;
cholesky(out_upper, in, true);
cholesky(out_lower, in, false);
} catch (af::exception& e) {
fprintf(stderr, "%s\n", e.what());
return 0;
A multi dimensional data container.
Definition: array.h:37
array copy() const
Perform deep copy of the array.
An ArrayFire exception class.
Definition: exception.h:22
virtual const char * what() const
Returns an error message for the exception in a string format.
Definition: exception.h:46
AFAPI void info()
AFAPI void setDevice(const int device)
Sets the current device.
Definition: algorithm.h:15
#define af_print(...)
Definition: util.h:148