* @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. */
| 337 | * times before control is returned to the backend. |
| 338 | */ |
| 339 | AnyType |
| 340 | closest_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 | |
| 361 | AnyType |
| 362 | closest_column_fixed::run(AnyType& args) { |
nothing calls this directly
no test coverage detected