Skip to content

Symmetric L2

Description

This tool computes the Symmetric L2 discrepancy of an input pointset using the following formula

from [Hic98].

Files

src/metrics/SymmetricL2.cpp  
include/utk/metrics/SymmetricL2.hpp

Usage


SymmetricL2Discrepancy calculator
Usage: ./SymmetricL2Discrepancy [OPTIONS]

Options:
  -h,--help                   Print this help message and exit
  -i,--input TEXT:FILE ... REQUIRED
                              Input file(s)
  -o,--output TEXT            Output file (empty is stdout)
  --silent                    Silence UTK logs
#include <utk/utils/PointsetIO.hpp>
#include <utk/utils/Pointset.hpp>
#include <utk/samplers/SamplerWhitenoise.hpp>
#include <utk/metrics/SymmetricL2.hpp>

int main()
{
    utk::Pointset<double> pts;

    utk::SamplerWhitenoise wn(2 /* dimension */);
    wn.setRandomSeed(/* empty means random, can also pass a number */);
    // Check for no errors
    if (wn.generateSamples(pts, 1024 /* Number of points */))
    {
        auto rslt = utk::SymmetricL2Discrepancy().compute(pts);
    }
}
import pyutk
import numpy as np

d = pyutk.SymmetricL2Discrepancy().compute(np.random.uniform(0, 1, (128, 2)))

License

BSD, see SymmetricL2.hpp