This example shows how to use hydra range semantic to perform lazy calculations.
#ifndef RANGE_SEMANTICS_INL_
#define RANGE_SEMANTICS_INL_
#include <iostream>
#include <algorithm>
#include <tclap/CmdLine.h>
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_RESET "\x1b[0m"
{
try {
TCLAP::CmdLine cmd("Command line arguments for ", '=');
TCLAP::ValueArg<size_t>
EArg(
"n",
"number-of-events",
"Number of events",
true, 10e6,
"size_t");
}
catch (TCLAP::ArgException &e) {
std::cerr << "error: " << e.error() << " for arg " << e.argId()
<< std::endl;
}
return Rho(::
sqrt( x*x + y*y));
});
return r > 1.0 ;
});
{
std::cout << "=========================================="<<std::endl;
std::cout << "| <--- DEVICE ---> |"<<std::endl;
std::cout << "=========================================="<<std::endl;
);
std::cout << std::endl<< std::endl<< std::endl;
std::cout << std::endl<<"hydra::sort_by_key" <<std::endl<< std::endl;
for(auto i : positions) {
if(is_inside(length(i))) std::cout << "\033[1;31m" << i << ", ";
else std::cout << "\033[1;33m" << i << ", ";
} std::cout <<"\033[0m\n";
std::cout << std::endl<< std::endl<< std::endl;
for(auto i : positions) {
if( is_inside(length(i)) ) std::cout << "\033[1;31m" << i << ", ";
else std::cout << "\033[1;33m" << i << ", ";
} std::cout <<"\033[0m\n";
std::cout << std::endl<< std::endl<< std::endl;
std::cout << std::endl<<"hydra::for_each" <<std::endl<< std::endl;
if( !is_inside(length(x, y)) ){
}
else {
}
}));
std::array<double, 3>
masses{0.13957061, 0.13957061,0.13957061};
[]
__hydra_dual__(
double Weights, hydra::Vector4R
A, hydra::Vector4R
B, hydra::Vector4R
C){
});
}
return 0;
}
#endif