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

Function af_pinverse

src/api/c/pinverse.cpp:170–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170af_err af_pinverse(af_array *out, const af_array in, const double tol,
171 const af_mat_prop options) {
172 try {
173 const ArrayInfo &i_info = getInfo(in);
174
175 af_dtype type = i_info.getType();
176
177 if (options != AF_MAT_NONE) {
178 AF_ERROR("Using this property is not yet supported in inverse",
179 AF_ERR_NOT_SUPPORTED);
180 }
181
182 ARG_ASSERT(1, i_info.isFloating()); // Only floating and complex types
183 ARG_ASSERT(2, tol >= 0.); // Ensure tolerance is not negative
184
185 af_array output;
186
187 if (i_info.ndims() == 0) { return af_retain_array(out, in); }
188
189 switch (type) {
190 case f32: output = pinverse<float>(in, tol); break;
191 case f64: output = pinverse<double>(in, tol); break;
192 case c32: output = pinverse<cfloat>(in, tol); break;
193 case c64: output = pinverse<cdouble>(in, tol); break;
194 default: TYPE_ERROR(1, type);
195 }
196 swap(*out, output);
197 }
198 CATCHALL;
199
200 return AF_SUCCESS;
201}

Callers 2

TESTFunction · 0.50
pinverseFunction · 0.50

Calls 5

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

Tested by

no test coverage detected