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

Function svec_svec_l2norm

methods/svec_util/src/pg_gp/svec_util.c:464–479  ·  view source on GitHub ↗

* svec_svec_l2norm - Computes the l2norm distance between two SVECs. */

Source from the content-addressed store, hash-verified

462 * svec_svec_l2norm - Computes the l2norm distance between two SVECs.
463 */
464Datum svec_svec_l2norm(PG_FUNCTION_ARGS)
465{
466 SvecType *svec1 = PG_GETARG_SVECTYPE_P(0);
467 SvecType *svec2 = PG_GETARG_SVECTYPE_P(1);
468
469 check_dimension(svec1,svec2,"l2norm");
470 SvecType *result = op_svec_by_svec_internal(subtract,svec1,svec2);
471
472 SparseData sdata = sdata_from_svec(result);
473 double accum;
474 accum = l2norm_sdata_values_double(sdata);
475
476 if (IS_NVP(accum)) PG_RETURN_NULL();
477
478 PG_RETURN_FLOAT8(accum);
479}
480
481PG_FUNCTION_INFO_V1( svec_svec_l1norm );
482/**

Callers

nothing calls this directly

Calls 4

check_dimensionFunction · 0.85
op_svec_by_svec_internalFunction · 0.85
sdata_from_svecFunction · 0.85

Tested by

no test coverage detected