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

Function svec_l2norm

methods/svec_util/src/pg_gp/svec_util.c:448–458  ·  view source on GitHub ↗

* svec_l2norm - computes the l2 norm of an svec */

Source from the content-addressed store, hash-verified

446 * svec_l2norm - computes the l2 norm of an svec
447 */
448Datum svec_l2norm(PG_FUNCTION_ARGS)
449{
450 SvecType *svec = PG_GETARG_SVECTYPE_P(0);
451 SparseData sdata = sdata_from_svec(svec);
452 double accum;
453 accum = l2norm_sdata_values_double(sdata);
454
455 if (IS_NVP(accum)) PG_RETURN_NULL();
456
457 PG_RETURN_FLOAT8(accum);
458}
459
460PG_FUNCTION_INFO_V1( svec_svec_l2norm );
461/**

Callers

nothing calls this directly

Calls 2

sdata_from_svecFunction · 0.85

Tested by

no test coverage detected