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

Function af_lu

src/api/c/lu.cpp:45–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45af_err af_lu(af_array *lower, af_array *upper, af_array *pivot,
46 const af_array in) {
47 try {
48 const ArrayInfo &i_info = getInfo(in);
49
50 if (i_info.ndims() > 2) {
51 AF_ERROR("lu can not be used in batch mode", AF_ERR_BATCH);
52 }
53
54 af_dtype type = i_info.getType();
55
56 ARG_ASSERT(0, lower != nullptr);
57 ARG_ASSERT(1, upper != nullptr);
58 ARG_ASSERT(2, pivot != nullptr);
59 ARG_ASSERT(3, i_info.isFloating()); // Only floating and complex types
60
61 if (i_info.ndims() == 0) {
62 AF_CHECK(af_create_handle(lower, 0, nullptr, type));
63 AF_CHECK(af_create_handle(upper, 0, nullptr, type));
64 AF_CHECK(af_create_handle(pivot, 0, nullptr, type));
65 return AF_SUCCESS;
66 }
67
68 switch (type) {
69 case f32: lu<float>(lower, upper, pivot, in); break;
70 case f64: lu<double>(lower, upper, pivot, in); break;
71 case c32: lu<cfloat>(lower, upper, pivot, in); break;
72 case c64: lu<cdouble>(lower, upper, pivot, in); break;
73 default: TYPE_ERROR(1, type);
74 }
75 }
76 CATCHALL;
77
78 return AF_SUCCESS;
79}
80
81af_err af_lu_inplace(af_array *pivot, af_array in, const bool is_lapack_piv) {
82 try {

Callers 2

TESTFunction · 0.50
luFunction · 0.50

Calls 4

isFloatingMethod · 0.80
af_create_handleFunction · 0.70
ndimsMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected