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

Function af_cholesky

src/api/c/cholesky.cpp:35–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35af_err af_cholesky(af_array *out, int *info, const af_array in,
36 const bool is_upper) {
37 try {
38 const ArrayInfo &i_info = getInfo(in);
39
40 if (i_info.ndims() > 2) {
41 AF_ERROR("cholesky can not be used in batch mode", AF_ERR_BATCH);
42 }
43
44 af_dtype type = i_info.getType();
45
46 if (i_info.ndims() == 0) {
47 return af_create_handle(out, 0, nullptr, type);
48 }
49 DIM_ASSERT(
50 1, i_info.dims()[0] == i_info.dims()[1]); // Only square matrices
51 ARG_ASSERT(2, i_info.isFloating()); // Only floating and complex types
52
53 af_array output;
54 switch (type) {
55 case f32: output = cholesky<float>(info, in, is_upper); break;
56 case f64: output = cholesky<double>(info, in, is_upper); break;
57 case c32: output = cholesky<cfloat>(info, in, is_upper); break;
58 case c64: output = cholesky<cdouble>(info, in, is_upper); break;
59 default: TYPE_ERROR(1, type);
60 }
61 std::swap(*out, output);
62 }
63 CATCHALL;
64
65 return AF_SUCCESS;
66}
67
68af_err af_cholesky_inplace(int *info, af_array in, const bool is_upper) {
69 try {

Callers 1

choleskyFunction · 0.50

Calls 6

swapFunction · 0.85
isFloatingMethod · 0.80
af_create_handleFunction · 0.70
ndimsMethod · 0.45
getTypeMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected