MCPcopy Create free account
hub / github.com/apache/madlib / run

Method run

src/modules/linalg/metric.cpp:339–359  ·  view source on GitHub ↗

* @brief Compute the minimum distance between a vector and any column of a * matrix * * This function calls a user-supplied function, for which it does not do * garbage collection. It is therefore meant to be called only constantly many * times before control is returned to the backend. */

Source from the content-addressed store, hash-verified

337 * times before control is returned to the backend.
338 */
339AnyType
340closest_column::run(AnyType& args) {
341 //if (true) throw std::runtime_error("Begin cc run\n");
342 try{
343 MappedMatrix M = args[0].getAs<MappedMatrix>();
344 MappedColumnVector x = args[1].getAs<MappedColumnVector>();
345 FunctionHandle dist = args[2].getAs<FunctionHandle>()
346 .unsetFunctionCallOptions(FunctionHandle::GarbageCollectionAfterCall);
347 string dist_fname = args[3].getAs<char *>();
348 std::string fname = dist_fn_name(dist_fname);
349 std::tuple<Index, double> result;
350 closestColumnsAndDistancesShortcut(M, x, dist, fname, &result, &result + 1);
351
352 AnyType tuple;
353 return tuple
354 << static_cast<int32_t>(std::get<0>(result))
355 << std::get<1>(result);
356 }catch (const ArrayWithNullException &e) {
357 return Null();
358 }
359}
360
361AnyType
362closest_column_fixed::run(AnyType& args) {

Callers

nothing calls this directly

Calls 14

dist_fn_nameFunction · 0.85
NullFunction · 0.85
distPNormFunction · 0.85
distNorm1Function · 0.85
distNorm2Function · 0.85
cosineSimilarityFunction · 0.85
squaredDistNorm2Function · 0.85
distAngleFunction · 0.85
distTanimotoFunction · 0.85
distJaccardFunction · 0.85

Tested by

no test coverage detected