// Copright (C) 1999-2021, Bernd Gaertner
// November 12, 2021
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// Contact:
// --------
// Bernd Gaertner
// Institute of Theoretical Computer Science
// ETH Zuerich
// CAB G31.1
// CH-8092 Zuerich, Switzerland
// http://www.inf.ethz.ch/personal/gaertner
// =========================================================================
// generates a set of random points, computes their smallest enclosing ball,
// and outputs the characteristics of this ball
//
// usage: miniball_example [seed]
// =========================================================================
#include
#include
#include "Miniball.hpp"
int main (int argc, char* argv[])
{
typedef double mytype; // coordinate type
int d = 5; // dimension
int n = 1000000; // number of points
double seed; // initialize random number generator
if (argc != 2) {
seed = 0;
} else
seed = std::atoi(argv[1]);
std::srand (seed);
// generate random points and store them in a 2-d array
// ----------------------------------------------------
mytype** ap = new mytype*[n];
for (int i=0; i >
MB;
MB mb (d, ap, ap+n);
// output results
// --------------
// center
std::cout << "Center:\n ";
const mytype* center = mb.center();
for(int i=0; i