本文整理汇总了C++中arguments::get_float方法的典型用法代码示例。如果您正苦于以下问题:C++ arguments::get_float方法的具体用法?C++ arguments::get_float怎么用?C++ arguments::get_float使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arguments
的用法示例。
在下文中一共展示了arguments::get_float方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_parameters
void rational_fitter_parsec_multi::set_parameters(const arguments& args)
{
_max_np = args.get_float("np", 10);
_max_nq = args.get_float("nq", _max_np);
_min_np = args.get_float("min-np", _max_np);
_min_nq = args.get_float("min-nq", _min_np);
_max_np = std::max<int>(_max_np, _min_np);
_max_nq = std::max<int>(_max_nq, _min_nq);
_boundary = args.get_float("boundary-constraint", 1.0f);
_nbcores = args.get_int( "nbcores", 2 );
_args = &args;
{
int argc = 1;
char **argv = (char**)malloc((argc+1)*sizeof(char*));
argv[0] = strdup( "./manao" );
argv[1] = NULL;
_dague = dague_init(_nbcores, &argc, &argv);
free(argv[0]);
free(argv);
}
}
示例2: data
BrdfSlice(const arguments& args,
int width, int height, int slice,
double* content)
: data(brdf_slice_parameters(args),
width * height * slice),
_width(width), _height(height), _slice(slice),
_data(content)
{
// Allocate data
if (args.is_defined("param") && parametrization().dimX() == 3)
_phi = (M_PI / 180.0) * args.get_float("phi", 90);
else
_phi = 0.5*M_PI;
// Is the position of the slice componnent (third coordinate)
// reversed? This ensure that some params can be displayed.
auto in_param = parametrization().input_parametrization();
_reverse = in_param == params::ISOTROPIC_TL_TV_PROJ_DPHI ||
in_param == params::SCHLICK_TL_TK_PROJ_DPHI ||
in_param == params::RETRO_TL_TVL_PROJ_DPHI;
// Update the domain
_max = max();
_min = min();
}
示例3: fit_data
bool rational_fitter_parallel::fit_data(const ptr<data>& dat, ptr<function>& fit, const arguments &args)
{
ptr<rational_function> r = dynamic_pointer_cast<rational_function>(fit) ;
if(!r)
{
std::cerr << "<<ERROR>> not passing the correct function class to the fitter: must be a rational_function" << std::endl ;
return false ;
}
ptr<vertical_segment> d = dynamic_pointer_cast<vertical_segment>(dat) ;
if(!d
|| d->confidence_interval_kind() != vertical_segment::ASYMMETRICAL_CONFIDENCE_INTERVAL)
{
std::cerr << "<<WARNING>> automatic convertion of the data object to vertical_segment," << std::endl;
std::cerr << "<<WARNING>> we advise you to perform convertion with a separate command." << std::endl;
size_t elem_size =
dat->parametrization().dimX() + 3*dat->parametrization().dimY();
double* content = new double[dat->size() * elem_size];
for(int i=0; i<dat->size(); ++i)
{
const vec x = dat->get(i);
for(int k=0; k<x.size(); ++k) {
content[i + k] = x[k];
}
for(int k=0; k<dat->parametrization().dimY(); ++k) {
content[i + k + dat->parametrization().dimX() + dat->parametrization().dimY()] =
(1.0 - args.get_float("dt", 0.1)) * x[k + dat->parametrization().dimX()];
}
for(int k=0; k<dat->parametrization().dimY(); ++k) {
content[i + k + dat->parametrization().dimX() + 2*dat->parametrization().dimY()] =
(1.0 + args.get_float("dt", 0.1)) * x[k + dat->parametrization().dimX()];
}
}
ptr<vertical_segment> vs(new vertical_segment(dat->parametrization(),
dat->size(),
std::shared_ptr<double>(content)));
d = vs;
}
// XXX: FIT and D may have different values of dimX() and dimY(), but
// this is fine: we convert values as needed in operator().
r->setMin(d->min());
r->setMax(d->max());
const int _min_np = args.get_int("min-np", 10);
const int _max_np = args.get_int("np", _min_np);
std::cout << "<<INFO>> N in [" << _min_np << ", " << _max_np << "]" << std::endl ;
const int nb_starting_points = args.get_int("nb-starting-points", 100);
std::cout << "<<INFO>> number of data point used in start: " << nb_starting_points << std::endl;
const int step = args.get_int("np-step", 1);
const bool use_delta = args.is_defined("use_delta");
for(int i=_min_np; i<=_max_np; i+=step)
{
std::cout << "<<INFO>> fit using np+nq = " << i << std::endl ;
std::cout.flush() ;
timer time ;
time.start() ;
#ifdef _OPENMP
const int nb_cores = args.get_int("nb-cores", omp_get_num_procs());
#ifdef DEBUG
std::cout << "<<DEBUG>> will use " << nb_cores << " threads to compute the quadratic programs" << std::endl ;
#endif
omp_set_num_threads(nb_cores) ;
#endif
double min_delta = std::numeric_limits<double>::max();
double min_l2_dist = std::numeric_limits<double>::max();
double mean_delta = 0.0;
int nb_sol_found = 0;
int nb_sol_tested = 0;
#pragma omp parallel for shared(r, args, nb_sol_found, nb_sol_tested, min_delta, mean_delta), schedule(dynamic,1)
for(int j=1; j<i; ++j)
{
// Compute the number of coefficients in the numerator and in the denominator
// from the current number of coefficients i and the current index in the
// loop j.
int temp_np = i - j;
int temp_nq = j;
//vec p(temp_np*r->dimY()), q(temp_nq*r->dimY());
// Allocate a rational function and set it to the correct size, dimensions
// and parametrizations.
ptr<rational_function> rk(NULL);
#pragma omp critical (args)
{
rk = dynamic_pointer_cast<rational_function>(
ptr<function>(plugins_manager::get_function(args,
r->parametrization())));
//.........这里部分代码省略.........