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

Function af_cholesky_inplace

src/api/c/cholesky.cpp:68–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68af_err af_cholesky_inplace(int *info, af_array in, const bool is_upper) {
69 try {
70 const ArrayInfo &i_info = getInfo(in);
71
72 if (i_info.ndims() > 2) {
73 AF_ERROR("cholesky can not be used in batch mode", AF_ERR_BATCH);
74 }
75
76 af_dtype type = i_info.getType();
77 if (i_info.ndims() == 0) { return AF_SUCCESS; }
78 ARG_ASSERT(1, i_info.isFloating()); // Only floating and complex types
79 DIM_ASSERT(
80 1, i_info.dims()[0] == i_info.dims()[1]); // Only square matrices
81
82 int out;
83
84 switch (type) {
85 case f32: out = cholesky_inplace<float>(in, is_upper); break;
86 case f64: out = cholesky_inplace<double>(in, is_upper); break;
87 case c32: out = cholesky_inplace<cfloat>(in, is_upper); break;
88 case c64: out = cholesky_inplace<cdouble>(in, is_upper); break;
89 default: TYPE_ERROR(1, type);
90 }
91 std::swap(*info, out);
92 }
93 CATCHALL;
94
95 return AF_SUCCESS;
96}

Callers 1

choleskyInPlaceFunction · 0.50

Calls 5

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

Tested by

no test coverage detected