MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / main

Function main

examples/lin_algebra/cholesky.cpp:16–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace af;
15
16int main(int argc, char* argv[]) {
17 try {
18 // Select a device and display arrayfire info
19 int device = argc > 1 ? atoi(argv[1]) : 0;
20 af::setDevice(device);
21 af::info();
22
23 int n = 5;
24 array t = randu(n, n);
25 array in = matmulNT(t, t) + identity(n, n) * n;
26 af_print(in);
27
28 printf("Running Cholesky InPlace\n");
29 array cin_upper = in.copy();
30 array cin_lower = in.copy();
31
32 choleskyInPlace(cin_upper, true);
33 choleskyInPlace(cin_lower, false);
34
35 af_print(cin_upper);
36 af_print(cin_lower);
37
38 printf("Running Cholesky Out of place\n");
39 array out_upper;
40 array out_lower;
41
42 cholesky(out_upper, in, true);
43 cholesky(out_lower, in, false);
44
45 af_print(out_upper);
46 af_print(out_lower);
47
48 } catch (af::exception& e) {
49 fprintf(stderr, "%s\n", e.what());
50 throw;
51 }
52
53 return 0;
54}

Callers

nothing calls this directly

Calls 8

infoFunction · 0.85
randuFunction · 0.85
matmulNTFunction · 0.85
choleskyInPlaceFunction · 0.85
setDeviceFunction · 0.50
identityFunction · 0.50
choleskyFunction · 0.50
copyMethod · 0.45

Tested by

no test coverage detected