* Copyright (c) 2014, ArrayFire
* All rights reserved.
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
#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;
array in = randu(5, 8);
array lin = in.copy();
printf("Running LU InPlace\n");
array pivot;
luInPlace(pivot, lin);
printf("Running LU with Upper Lower Factorization\n");
lu(lower, upper, pivot, in);
} catch (af::exception& e) {
fprintf(stderr, "%s\n", e.what());
return 0;
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 array lower(const array &in, bool is_unit_diag=false)
AFAPI array upper(const array &in, bool is_unit_diag=false)
AFAPI void info()
AFAPI void setDevice(const int device)
Sets the current device.
AFAPI void luInPlace(array &pivot, array &in, const bool is_lapack_piv=true)
C++ Interface for in place LU decomposition.
AFAPI void lu(array &out, array &pivot, const array &in, const bool is_lapack_piv=true)
C++ Interface for LU decomposition in packed format.
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:327
AFAPI array randu(const dim4 &dims, const dtype ty, randomEngine &r)
Definition: algorithm.h:15
#define af_print(...)
Definition: util.h:148