// --------------------------------------------------
	// Approx function Value - solution_set's value at x_pos		
double Individual::approx_func(){
	double x = get_x_pos();
	double a, b;
	a = f_1(x, solution_set.at(0), solution_set.at(1));
	b = f_2(x, solution_set.at(2), solution_set.at(3));
	approx_value = (a + b);
	//cout << endl << "Approximate Value is: " << approx_value << endl;
	return approx_value;
}
// --------------------------------------------------			// TODO - MOVE to Function 
	// Real Function Value - real coefficient_set's value at x_pos
double Individual::real_func(){
	double x = get_x_pos();
	double a, b;
	a = f_1(x, real_set.at(0), real_set.at(1));
	b = f_2(x, real_set.at(2), real_set.at(3));
	real_value = (a + b);
	//cout << endl << "real value is: " << real_value << endl;
	return real_value;
}
Ejemplo n.º 3
0
Archivo: prog2.c Proyecto: ruimgf/Psis
int main(){
	int a;
	void (*f_1)()=NULL;
	void (*f_2)()=NULL;
	void * lib=NULL;
	printf("What version of the functions you whant to use?\n");
	printf("\t1 - Normal    (test1)\n");
	printf("\t2 - Optimized (test2)\n");
	scanf("%d", &a);
	if (a == 1){
		printf("running the normal versions from \n");
		
		/* call func_1 from test1 */
		/* call func_2 from test1 */
	   lib = dlopen("/home/rui/psis/lab1/rui/V_VI/test1.so", RTLD_LAZY);
	   if (!lib)
	   {
		  printf("%s\n", dlerror());
		  exit(1);

	   }


	}else{
		if(a== 2){
			printf("runnin the normal versions\n");
			/* call func_1 from test2 */
			/* call func_2 from test2 */
			lib = dlopen("/home/rui/psis/lab1/rui/V_VI/test2.so", RTLD_LAZY);
			if (!lib)
			{
				printf("%s\n", dlerror());
				exit(1);

			}
			
		}else{
			printf("Not running anything\n");
			exit(3);
		}
	}
	f_1 = dlsym(lib, "func_1");
	f_2 = dlsym(lib, "func_2");
	f_1();
	f_2();
	exit(0);
	
	
}
Ejemplo n.º 4
0
Archivo: lazy.cpp Proyecto: wildpea/Fit
FIT_TEST_CASE()
{
    int const x = 1;
    int const y = 2;

    FIT_TEST_CHECK( fit::lazy(f_1())( fit::lazy(f_1())(std::placeholders::_1))(x) == 1L );
    FIT_TEST_CHECK( fit::lazy(f_1())( fit::lazy(f_2())(std::placeholders::_1, std::placeholders::_2))(x, y) == 21L );
    FIT_TEST_CHECK( fit::lazy(f_2())( fit::lazy(f_1())(std::placeholders::_1), fit::lazy(f_1())(std::placeholders::_1))(x) == 11L );
    FIT_TEST_CHECK( fit::lazy(f_2())( fit::lazy(f_1())(std::placeholders::_1), fit::lazy(f_1())( std::placeholders::_2))(x, y) == 21L );
    FIT_TEST_CHECK( fit::lazy(f_1())( fit::lazy(f_0())())() == 17041L );

    FIT_STATIC_TEST_CHECK( fit::lazy(f_1())( fit::lazy(f_1())(test_placeholder<1>()))(x) == 1L );
    FIT_STATIC_TEST_CHECK( fit::lazy(f_1())( fit::lazy(f_2())(test_placeholder<1>(), test_placeholder<2>()))(x, y) == 21L );
    FIT_STATIC_TEST_CHECK( fit::lazy(f_2())( fit::lazy(f_1())(test_placeholder<1>()), fit::lazy(f_1())(test_placeholder<1>()))(x) == 11L );
    FIT_STATIC_TEST_CHECK( fit::lazy(f_2())( fit::lazy(f_1())(test_placeholder<1>()), fit::lazy(f_1())( test_placeholder<2>()))(x, y) == 21L );
    FIT_STATIC_TEST_CHECK( fit::lazy(f_1())( fit::lazy(f_0())())() == 17041L );

    FIT_TEST_CHECK( (fit::lazy(fv_1())( fit::lazy(f_1())(std::placeholders::_1))(x), (global_result == 1L)) );
    FIT_TEST_CHECK( (fit::lazy(fv_1())( fit::lazy(f_2())(std::placeholders::_1, std::placeholders::_2))(x, y), (global_result == 21L)) );
    FIT_TEST_CHECK( (fit::lazy(fv_2())( fit::lazy(f_1())(std::placeholders::_1), fit::lazy(f_1())(std::placeholders::_1))(x), (global_result == 11L)) );
    FIT_TEST_CHECK( (fit::lazy(fv_2())( fit::lazy(f_1())(std::placeholders::_1), fit::lazy(f_1())( std::placeholders::_2))(x, y), (global_result == 21L)) );
    FIT_TEST_CHECK( (fit::lazy(fv_1())( fit::lazy(f_0())())(), (global_result == 17041L)) );
}
void test() {
  f_8(0); // expected-warning{{'f_8' is deprecated}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:6}:"new8"
  f_2(0); // expected-warning{{'f_2' is deprecated: first deprecated in OS X 9.0}}
  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:6}:"new2"
}