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

Function af_rank

src/api/c/rank.cpp:60–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60af_err af_rank(uint* out, const af_array in, const double tol) {
61 try {
62 const ArrayInfo& i_info = getInfo(in);
63
64 if (i_info.ndims() > 2) {
65 AF_ERROR("solve can not be used in batch mode", AF_ERR_BATCH);
66 }
67
68 af_dtype type = i_info.getType();
69
70 ARG_ASSERT(1, i_info.isFloating()); // Only floating and complex types
71 ARG_ASSERT(0, out != nullptr);
72
73 uint output = 0;
74 if (i_info.ndims() != 0) {
75 switch (type) {
76 case f32: output = rank<float>(in, tol); break;
77 case f64: output = rank<double>(in, tol); break;
78 case c32: output = rank<cfloat>(in, tol); break;
79 case c64: output = rank<cdouble>(in, tol); break;
80 default: TYPE_ERROR(1, type);
81 }
82 }
83 std::swap(*out, output);
84 }
85 CATCHALL;
86
87 return AF_SUCCESS;
88}

Callers 2

TESTFunction · 0.50
rankFunction · 0.50

Calls 4

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

Tested by

no test coverage detected