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

Function svec_svec_l1norm

methods/svec_util/src/pg_gp/svec_util.c:485–500  ·  view source on GitHub ↗

* svec_svec_l1norm - Computes the l1norm distance between two SVECs. */

Source from the content-addressed store, hash-verified

483 * svec_svec_l1norm - Computes the l1norm distance between two SVECs.
484 */
485Datum svec_svec_l1norm(PG_FUNCTION_ARGS)
486{
487 SvecType *svec1 = PG_GETARG_SVECTYPE_P(0);
488 SvecType *svec2 = PG_GETARG_SVECTYPE_P(1);
489
490 check_dimension(svec1,svec2,"l1norm");
491 SvecType *result = op_svec_by_svec_internal(subtract,svec1,svec2);
492
493 SparseData sdata = sdata_from_svec(result);
494 double accum;
495 accum = l1norm_sdata_values_double(sdata);
496
497 if (IS_NVP(accum)) PG_RETURN_NULL();
498
499 PG_RETURN_FLOAT8(accum);
500}
501
502PG_FUNCTION_INFO_V1( svec_svec_angle );
503/**

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