diff --git a/ADOL-C/c_interface/ADOLCTBInterface.cpp b/ADOL-C/c_interface/ADOLCTBInterface.cpp deleted file mode 100644 index a43ee394..00000000 --- a/ADOL-C/c_interface/ADOLCTBInterface.cpp +++ /dev/null @@ -1,313 +0,0 @@ -#include -#include "ADOLCTBInterface.h" - -/* -Constructor & Destructor for class tape-based adouble -*/ -extern "C" -{ - // Constructor - TBAdoubleHandle create_tb_adouble(double x) - { - return new adouble(x); - } - TBAdoubleHandle create_tb_adouble_empty() - { - return new adouble(); - } - - // Destructor - void free_tb_adouble(TBAdoubleHandle a) - { - return delete static_cast(a); - } -} - -/* -Utilities for adouble -*/ -extern "C" -{ - double get_tb_value(TBAdoubleHandle a) - { - return static_cast(a)->getValue(); - } -} - -/* -Arithmetics for class adouble -*/ -extern "C" -{ - TBAdoubleHandle add_tb_adouble(const TBAdoubleHandle a, const TBAdoubleHandle b) - { - return new adouble(*static_cast(a) + *static_cast(b)); - } - TBAdoubleHandle add_double_tb_adouble(double x, TBAdoubleHandle b) - { - return new adouble(x + *static_cast(b)); - } - TBAdoubleHandle add_tb_adouble_double(TBAdoubleHandle a, double x) - { - return new adouble(*static_cast(a) + x); - } - TBAdoubleHandle mult_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return new adouble(*static_cast(a) * *static_cast(b)); - } - TBAdoubleHandle mult_double_tb_adouble(double x, TBAdoubleHandle b) - { - return new adouble(x * *static_cast(b)); - } - TBAdoubleHandle mult_tb_adouble_double(TBAdoubleHandle a, double x) - { - return new adouble(*static_cast(a) * x); - } - TBAdoubleHandle subtr_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return new adouble(*static_cast(a) - *static_cast(b)); - } - TBAdoubleHandle subtr_double_tb_adouble(double x, TBAdoubleHandle b) - { - return new adouble(x - *static_cast(b)); - } - TBAdoubleHandle subtr_tb_adouble_double(TBAdoubleHandle a, double x) - { - return new adouble(*static_cast(a) - x); - } - TBAdoubleHandle div_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return new adouble(*static_cast(a) / *static_cast(b)); - } - TBAdoubleHandle div_double_tb_adouble(double x, TBAdoubleHandle b) - { - return new adouble(x / *static_cast(b)); - } - TBAdoubleHandle div_tb_adouble_double(TBAdoubleHandle a, double x) - { - return new adouble(*static_cast(a) / x); - } - TBAdoubleHandle max_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return new adouble(fmax(*static_cast(a), *static_cast(b))); - } - TBAdoubleHandle max_double_tb_adouble(double x, TBAdoubleHandle b) - { - return new adouble(fmax(x, *static_cast(b))); - } - TBAdoubleHandle max_tb_adouble_double(TBAdoubleHandle a, double x) - { - return new adouble(fmax(*static_cast(a), x)); - } - TBAdoubleHandle min_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return new adouble(fmin(*static_cast(a), *static_cast(b))); - } - TBAdoubleHandle min_double_tb_adouble(double x, TBAdoubleHandle b) - { - return new adouble(fmin(x, *static_cast(b))); - } - TBAdoubleHandle min_tb_adouble_double(TBAdoubleHandle a, double x) - { - return new adouble(fmin(*static_cast(a), x)); - } - TBAdoubleHandle pow_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return new adouble(pow(*static_cast(a), *static_cast(b))); - } - TBAdoubleHandle pow_tb_adouble_double(TBAdoubleHandle a, double x) - { - return new adouble(pow(*static_cast(a), x)); - } - bool ge_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return *static_cast(a) >= *static_cast(b); - } - bool ge_double_tb_adouble(double x, TBAdoubleHandle b) - { - return x >= *static_cast(b); - } - bool ge_tb_adouble_double(TBAdoubleHandle a, double x) - { - return *static_cast(a) >= x; - } - bool g_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return *static_cast(a) > *static_cast(b); - } - bool g_double_tb_adouble(double x, TBAdoubleHandle b) - { - return x > *static_cast(b); - } - bool g_tb_adouble_double(TBAdoubleHandle a, double x) - { - return *static_cast(a) > x; - } - bool le_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return *static_cast(a) <= *static_cast(b); - } - bool le_double_tb_adouble(double x, TBAdoubleHandle b) - { - return x <= *static_cast(b); - } - bool le_tb_adouble_double(TBAdoubleHandle a, double x) - { - return *static_cast(a) <= x; - } - bool l_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return *static_cast(a) < *static_cast(b); - } - bool l_double_tb_adouble(double x, TBAdoubleHandle b) - { - return x < *static_cast(b); - } - bool l_tb_adouble_double(TBAdoubleHandle a, double x) - { - return *static_cast(a) < x; - } - bool eq_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b) - { - return *static_cast(a) == *static_cast(b); - } - bool eq_double_tb_adouble(double x, TBAdoubleHandle b) - { - return x == *static_cast(b); - } - bool eq_tb_adouble_double(TBAdoubleHandle a, double x) - { - return *static_cast(a) == x; - } - TBAdoubleHandle tb_abs(TBAdoubleHandle a) - { - return new adouble(fabs(*static_cast(a))); - } - TBAdoubleHandle tb_sqrt(TBAdoubleHandle a) - { - return new adouble(sqrt(*static_cast(a))); - } - TBAdoubleHandle tb_log(TBAdoubleHandle a) - { - return new adouble(log(*static_cast(a))); - } - TBAdoubleHandle tb_log10(TBAdoubleHandle a) - { - return new adouble(log10(*static_cast(a))); - } - TBAdoubleHandle tb_sin(TBAdoubleHandle a) - { - return new adouble(sin(*static_cast(a))); - } - TBAdoubleHandle tb_cos(TBAdoubleHandle a) - { - return new adouble(cos(*static_cast(a))); - } - TBAdoubleHandle tb_tan(TBAdoubleHandle a) - { - return new adouble(tan(*static_cast(a))); - } - TBAdoubleHandle tb_exp(TBAdoubleHandle a) - { - return new adouble(exp(*static_cast(a))); - } - TBAdoubleHandle tb_asin(TBAdoubleHandle a) - { - return new adouble(asin(*static_cast(a))); - } - TBAdoubleHandle tb_acos(TBAdoubleHandle a) - { - return new adouble(acos(*static_cast(a))); - } - TBAdoubleHandle tb_atan(TBAdoubleHandle a) - { - return new adouble(atan(*static_cast(a))); - } - TBAdoubleHandle tb_sinh(TBAdoubleHandle a) - { - return new adouble(sinh(*static_cast(a))); - } - TBAdoubleHandle tb_cosh(TBAdoubleHandle a) - { - return new adouble(cosh(*static_cast(a))); - } - TBAdoubleHandle tb_tanh(TBAdoubleHandle a) - { - return new adouble(tanh(*static_cast(a))); - } - TBAdoubleHandle tb_asinh(TBAdoubleHandle a) - { - return new adouble(asinh(*static_cast(a))); - } - TBAdoubleHandle tb_acosh(TBAdoubleHandle a) - { - return new adouble(acosh(*static_cast(a))); - } - TBAdoubleHandle tb_atanh(TBAdoubleHandle a) - { - return new adouble(atanh(*static_cast(a))); - } - TBAdoubleHandle tb_ceil(TBAdoubleHandle a) - { - return new adouble(ceil(*static_cast(a))); - } - TBAdoubleHandle tb_floor(TBAdoubleHandle a) - { - return new adouble(floor(*static_cast(a))); - } - TBAdoubleHandle tb_ldexp(TBAdoubleHandle a, int n) - { - return new adouble(ldexp(*static_cast(a), n)); - } - TBAdoubleHandle tb_erf(TBAdoubleHandle a) - { - return new adouble(erf(*static_cast(a))); - } -} - -/* -Tape utilities -*/ -extern "C" -{ - int c_trace_on(short int tag, int keep) - { - return trace_on(tag, keep); - } - void c_trace_off(int flag) - { - return trace_off(flag); - } - void create_independent(TBAdoubleHandle a, double x) - { - *static_cast(a) <<= x; - } - void create_dependent(TBAdoubleHandle a, double *y) - { - *static_cast(a) >>= *y; - } - size_t num_independent(short tape_id) - { - size_t y[STAT_SIZE]; - tapestats(tape_id, y); - return y[NUM_INDEPENDENTS]; - } - size_t num_dependent(short tape_id) - { - size_t y[STAT_SIZE]; - tapestats(tape_id, y); - return y[NUM_DEPENDENTS]; - } - void enable_min_max_using_abs() - { - return enableMinMaxUsingAbs(); - } - void disable_min_max_using_abs() - { - return disableMinMaxUsingAbs(); - } - TBAdoubleHandle mkparam_(const double val) - { - return new adouble(mkparam(val)); - } -} diff --git a/ADOL-C/c_interface/ADOLCTBInterface.h b/ADOL-C/c_interface/ADOLCTBInterface.h deleted file mode 100644 index df889959..00000000 --- a/ADOL-C/c_interface/ADOLCTBInterface.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef ADOLC_TB_INTERFACE_H -#define ADOLC_TB_INTERFACE_H - -#ifdef __cplusplus -extern "C" -{ -#endif - // Used to handle Tape-based adouble as void* - typedef void *TBAdoubleHandle; -#ifdef __cplusplus -} -#endif - -/* -Constructor & Destructor for class adouble -*/ -#ifdef __cplusplus -extern "C" -{ -#endif - // Constructor - TBAdoubleHandle create_tb_adouble(double x); - TBAdoubleHandle create_tb_adouble_empty(); - - // Destructor - void free_tb_adouble(TBAdoubleHandle a); -#ifdef __cplusplus -} -#endif - -/* -Utilities for adouble -*/ -#ifdef __cplusplus -extern "C" -{ -#endif - double get_tb_value(TBAdoubleHandle a); -#ifdef __cplusplus -} -#endif - -/* -Arithmetics for class tb adouble -*/ -#ifdef __cplusplus -extern "C" -{ -#endif - TBAdoubleHandle add_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - TBAdoubleHandle add_double_tb_adouble(double x, TBAdoubleHandle b); - TBAdoubleHandle add_tb_adouble_double(TBAdoubleHandle a, double x); - - TBAdoubleHandle mult_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - TBAdoubleHandle mult_double_tb_adouble(double x, TBAdoubleHandle b); - TBAdoubleHandle mult_tb_adouble_double(TBAdoubleHandle a, double x); - - TBAdoubleHandle subtr_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - TBAdoubleHandle subtr_double_tb_adouble(double x, TBAdoubleHandle b); - TBAdoubleHandle subtr_tb_adouble_double(TBAdoubleHandle a, double x); - - TBAdoubleHandle div_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - TBAdoubleHandle div_double_tb_adouble(double x, TBAdoubleHandle b); - TBAdoubleHandle div_tb_adouble_double(TBAdoubleHandle a, double x); - - TBAdoubleHandle max_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - TBAdoubleHandle max_double_tb_adouble(double x, TBAdoubleHandle b); - TBAdoubleHandle max_tb_adouble_double(TBAdoubleHandle a, double x); - - TBAdoubleHandle min_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - TBAdoubleHandle min_double_tb_adouble(double x, TBAdoubleHandle b); - TBAdoubleHandle min_tb_adouble_double(TBAdoubleHandle a, double x); - - TBAdoubleHandle pow_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - TBAdoubleHandle pow_tb_adouble_double(TBAdoubleHandle a, double x); - - bool ge_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - bool ge_double_tb_adouble(double x, TBAdoubleHandle b); - bool ge_tb_adouble_double(TBAdoubleHandle a, double x); - - bool g_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - bool g_double_tb_adouble(double x, TBAdoubleHandle b); - bool g_tb_adouble_double(TBAdoubleHandle a, double x); - - bool le_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - bool le_double_tb_adouble(double x, TBAdoubleHandle b); - bool le_tb_adouble_double(TBAdoubleHandle a, double x); - - bool l_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - bool l_double_tb_adouble(double x, TBAdoubleHandle b); - bool l_tb_adouble_double(TBAdoubleHandle a, double x); - - bool eq_tb_adouble(TBAdoubleHandle a, TBAdoubleHandle b); - bool eq_double_tb_adouble(double x, TBAdoubleHandle b); - bool eq_tb_adouble_double(TBAdoubleHandle a, double x); - - TBAdoubleHandle tb_abs(TBAdoubleHandle a); - TBAdoubleHandle tb_sqrt(TBAdoubleHandle a); - TBAdoubleHandle tb_log(TBAdoubleHandle a); - TBAdoubleHandle tb_log10(TBAdoubleHandle a); - TBAdoubleHandle tb_sin(TBAdoubleHandle a); - TBAdoubleHandle tb_cos(TBAdoubleHandle a); - TBAdoubleHandle tb_tan(TBAdoubleHandle a); - TBAdoubleHandle tb_exp(TBAdoubleHandle a); - TBAdoubleHandle tb_asin(TBAdoubleHandle a); - TBAdoubleHandle tb_acos(TBAdoubleHandle a); - TBAdoubleHandle tb_atan(TBAdoubleHandle a); - TBAdoubleHandle tb_sinh(TBAdoubleHandle a); - TBAdoubleHandle tb_cosh(TBAdoubleHandle a); - TBAdoubleHandle tb_tanh(TBAdoubleHandle a); - TBAdoubleHandle tb_asinh(TBAdoubleHandle a); - TBAdoubleHandle tb_acosh(TBAdoubleHandle a); - TBAdoubleHandle tb_atanh(TBAdoubleHandle a); - TBAdoubleHandle tb_ceil(TBAdoubleHandle a); - TBAdoubleHandle tb_floor(TBAdoubleHandle a); - TBAdoubleHandle tb_ldexp(TBAdoubleHandle a, int n); - TBAdoubleHandle tb_erf(TBAdoubleHandle a); -#ifdef __cplusplus -} -#endif - -/* -Tape utilities -*/ -#ifdef __cplusplus -extern "C" -{ -#endif - int c_trace_on(short int tag, int keep = 0); - void c_trace_off(int flag = 0); - void create_independent(TBAdoubleHandle a, double x); - void create_dependent(TBAdoubleHandle a, double *y); - size_t num_independent(short tape_id); - size_t num_dependent(short tape_id); - void enable_min_max_using_abs(); - void disable_min_max_using_abs(); - TBAdoubleHandle mkparam_(const double val); -#ifdef __cplusplus -} -#endif - -#endif // ADOLC_TB_INTERFACE_H \ No newline at end of file diff --git a/ADOL-C/c_interface/ADOLCTLInterface.cpp b/ADOL-C/c_interface/ADOLCTLInterface.cpp deleted file mode 100644 index 14258d9d..00000000 --- a/ADOL-C/c_interface/ADOLCTLInterface.cpp +++ /dev/null @@ -1,297 +0,0 @@ -#include -#include "ADOLCTLInterface.h" - -/* -Constructor & Destructor for class tape-less adouble -*/ -extern "C" -{ - // Constructor - TLAdoubleHandle create_tl_adouble(const double x) - { - return new adtl::adouble(x); - } - TLAdoubleHandle create_tl_adouble_empty() - { - return new adtl::adouble(); - } - TLAdoubleHandle create_tl_adouble_with_ad(const double val, const double *ad_val) - { - return new adtl::adouble(val, ad_val); - } - // Destructor - void free_tl_adouble(TLAdoubleHandle a) - { - return delete static_cast(a); - } -} - -/* -Utilities for adouble -*/ -extern "C" -{ - void set_num_dir(const size_t n) - { - return adtl::setNumDir(n); - } - - void set_tl_value(TLAdoubleHandle a, const double val) - { - return static_cast(a)->setValue(val); - } - - void set_tl_ad_value(TLAdoubleHandle a, const double *const val) - { - return static_cast(a)->setADValue(val); - } - - void set_tl_ad_value_idx(TLAdoubleHandle a, size_t pos, const double val) - { - return static_cast(a)->setADValue(pos, val); - } - - double get_tl_value(TLAdoubleHandle a) - { - return static_cast(a)->getValue(); - } - const double *get_tl_ad_values(TLAdoubleHandle a) - { - return (static_cast(a))->getADValue(); - } - double get_tl_ad_value_idx(TLAdoubleHandle a, const size_t pos) - { - return static_cast(a)->getADValue(pos); - } -} - -/* -Arithmetics for class adouble -*/ -extern "C" -{ - TLAdoubleHandle add_tl_adouble(const TLAdoubleHandle a, const TLAdoubleHandle b) - { - return new adtl::adouble(*static_cast(a) + *static_cast(b)); - } - TLAdoubleHandle add_double_tl_adouble(double x, TLAdoubleHandle b) - { - return new adtl::adouble(x + *static_cast(b)); - } - TLAdoubleHandle add_tl_adouble_double(TLAdoubleHandle a, double x) - { - return new adtl::adouble(*static_cast(a) + x); - } - TLAdoubleHandle mult_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return new adtl::adouble(*static_cast(a) * *static_cast(b)); - } - TLAdoubleHandle mult_double_tl_adouble(double x, TLAdoubleHandle b) - { - return new adtl::adouble(x * *static_cast(b)); - } - TLAdoubleHandle mult_tl_adouble_double(TLAdoubleHandle a, double x) - { - return new adtl::adouble(*static_cast(a) * x); - } - TLAdoubleHandle subtr_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return new adtl::adouble(*static_cast(a) - *static_cast(b)); - } - TLAdoubleHandle subtr_double_tl_adouble(double x, TLAdoubleHandle b) - { - return new adtl::adouble(x - *static_cast(b)); - } - TLAdoubleHandle subtr_tl_adouble_double(TLAdoubleHandle a, double x) - { - return new adtl::adouble(*static_cast(a) - x); - } - TLAdoubleHandle div_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return new adtl::adouble(*static_cast(a) / *static_cast(b)); - } - TLAdoubleHandle div_double_tl_adouble(double x, TLAdoubleHandle b) - { - return new adtl::adouble(x / *static_cast(b)); - } - TLAdoubleHandle div_tl_adouble_double(TLAdoubleHandle a, double x) - { - return new adtl::adouble(*static_cast(a) / x); - } - TLAdoubleHandle max_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return new adtl::adouble(fmax(*static_cast(a), *static_cast(b))); - } - TLAdoubleHandle max_double_tl_adouble(double x, TLAdoubleHandle b) - { - return new adtl::adouble(fmax(x, *static_cast(b))); - } - TLAdoubleHandle max_tl_adouble_double(TLAdoubleHandle a, double x) - { - return new adtl::adouble(fmax(*static_cast(a), x)); - } - TLAdoubleHandle min_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return new adtl::adouble(fmin(*static_cast(a), *static_cast(b))); - } - TLAdoubleHandle min_double_tl_adouble(double x, TLAdoubleHandle b) - { - return new adtl::adouble(fmin(x, *static_cast(b))); - } - TLAdoubleHandle min_tl_adouble_double(TLAdoubleHandle a, double x) - { - return new adtl::adouble(fmin(*static_cast(a), x)); - } - TLAdoubleHandle pow_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return new adtl::adouble(pow(*static_cast(a), *static_cast(b))); - } - TLAdoubleHandle pow_tl_adouble_double(TLAdoubleHandle a, double x) - { - return new adtl::adouble(pow(*static_cast(a), x)); - } - bool ge_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return *static_cast(a) >= *static_cast(b); - } - bool ge_double_tl_adouble(double x, TLAdoubleHandle b) - { - return x >= *static_cast(b); - } - bool ge_tl_adouble_double(TLAdoubleHandle a, double x) - { - return *static_cast(a) >= x; - } - bool g_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return *static_cast(a) > *static_cast(b); - } - bool g_double_tl_adouble(double x, TLAdoubleHandle b) - { - return x > *static_cast(b); - } - bool g_tl_adouble_double(TLAdoubleHandle a, double x) - { - return *static_cast(a) > x; - } - bool le_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return *static_cast(a) <= *static_cast(b); - } - bool le_double_tl_adouble(double x, TLAdoubleHandle b) - { - return x <= *static_cast(b); - } - bool le_tl_adouble_double(TLAdoubleHandle a, double x) - { - return *static_cast(a) <= x; - } - bool l_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return *static_cast(a) < *static_cast(b); - } - bool l_double_tl_adouble(double x, TLAdoubleHandle b) - { - return x < *static_cast(b); - } - bool l_tl_adouble_double(TLAdoubleHandle a, double x) - { - return *static_cast(a) < x; - } - bool eq_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b) - { - return *static_cast(a) == *static_cast(b); - } - bool eq_double_tl_adouble(double x, TLAdoubleHandle b) - { - return x == *static_cast(b); - } - bool eq_tl_adouble_double(TLAdoubleHandle a, double x) - { - return *static_cast(a) == x; - } - TLAdoubleHandle tl_abs(TLAdoubleHandle a) - { - return new adtl::adouble(fabs(*static_cast(a))); - } - TLAdoubleHandle tl_sqrt(TLAdoubleHandle a) - { - return new adtl::adouble(sqrt(*static_cast(a))); - } - TLAdoubleHandle tl_log(TLAdoubleHandle a) - { - return new adtl::adouble(log(*static_cast(a))); - } - TLAdoubleHandle tl_log10(TLAdoubleHandle a) - { - return new adtl::adouble(log10(*static_cast(a))); - } - TLAdoubleHandle tl_sin(TLAdoubleHandle a) - { - return new adtl::adouble(sin(*static_cast(a))); - } - TLAdoubleHandle tl_cos(TLAdoubleHandle a) - { - return new adtl::adouble(cos(*static_cast(a))); - } - TLAdoubleHandle tl_tan(TLAdoubleHandle a) - { - return new adtl::adouble(tan(*static_cast(a))); - } - TLAdoubleHandle tl_exp(TLAdoubleHandle a) - { - return new adtl::adouble(exp(*static_cast(a))); - } - TLAdoubleHandle tl_asin(TLAdoubleHandle a) - { - return new adtl::adouble(asin(*static_cast(a))); - } - TLAdoubleHandle tl_acos(TLAdoubleHandle a) - { - return new adtl::adouble(acos(*static_cast(a))); - } - TLAdoubleHandle tl_atan(TLAdoubleHandle a) - { - return new adtl::adouble(atan(*static_cast(a))); - } - TLAdoubleHandle tl_sinh(TLAdoubleHandle a) - { - return new adtl::adouble(sinh(*static_cast(a))); - } - TLAdoubleHandle tl_cosh(TLAdoubleHandle a) - { - return new adtl::adouble(cosh(*static_cast(a))); - } - TLAdoubleHandle tl_tanh(TLAdoubleHandle a) - { - return new adtl::adouble(tanh(*static_cast(a))); - } - TLAdoubleHandle tl_asinh(TLAdoubleHandle a) - { - return new adtl::adouble(asinh(*static_cast(a))); - } - TLAdoubleHandle tl_acosh(TLAdoubleHandle a) - { - return new adtl::adouble(acosh(*static_cast(a))); - } - TLAdoubleHandle tl_atanh(TLAdoubleHandle a) - { - return new adtl::adouble(atanh(*static_cast(a))); - } - TLAdoubleHandle tl_ceil(TLAdoubleHandle a) - { - return new adtl::adouble(ceil(*static_cast(a))); - } - TLAdoubleHandle tl_floor(TLAdoubleHandle a) - { - return new adtl::adouble(floor(*static_cast(a))); - } - TLAdoubleHandle tl_ldexp(TLAdoubleHandle a, int n) - { - return new adtl::adouble(ldexp(*static_cast(a), n)); - } - TLAdoubleHandle tl_erf(TLAdoubleHandle a) - { - return new adtl::adouble(erf(*static_cast(a))); - } -} diff --git a/ADOL-C/c_interface/ADOLCTLInterface.h b/ADOL-C/c_interface/ADOLCTLInterface.h deleted file mode 100644 index f82609a8..00000000 --- a/ADOL-C/c_interface/ADOLCTLInterface.h +++ /dev/null @@ -1,129 +0,0 @@ -#ifdef ADOLC_TL_INTERFACE_H -#define ADOLC_TL_INTERFACE_H - -#ifdef __cplusplus -extern "C" -{ -#endif - // Used to handle Tape-based adouble as void* - typedef void *TLAdoubleHandle; -#ifdef __cplusplus -} -#endif - -/* -Constructor & Destructor for class tape-less adouble -*/ -#ifdef __cplusplus -extern "C" -{ -#endif - // Constructor - TLAdoubleHandle create_tl_adouble(double x); - TLAdoubleHandle create_tl_adouble_with_ad(const double val, const double *ad_val); - TLAdoubleHandle create_tl_adouble_empty(); - - // Destructor - void free_tl_adouble(TLAdoubleHandle a); -#ifdef __cplusplus -} -#endif - -/* -Utilities for adouble -*/ -#ifdef __cplusplus -extern "C" -{ -#endif - void set_num_dir(const size_t n); - void set_tl_value(TLAdoubleHandle a, const double val); - void set_tl_ad_value(TLAdoubleHandle a, const double *const val); - void set_tl_ad_value_idx(TLAdoubleHandle a, const size_t pos, const double val); - double get_tl_value(TLAdoubleHandle a); - const double *get_tl_ad_values(TLAdoubleHandle a); - double get_tl_ad_value_idx(TLAdoubleHandle a, const size_t pos); -#ifdef __cplusplus -} -#endif - -/* -Arithmetics for class tl adouble -*/ -#ifdef __cplusplus -extern "C" -{ -#endif - TLAdoubleHandle add_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - TLAdoubleHandle add_double_tl_adouble(double x, TLAdoubleHandle b); - TLAdoubleHandle add_tl_adouble_double(TLAdoubleHandle a, double x); - - TLAdoubleHandle mult_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - TLAdoubleHandle mult_double_tl_adouble(double x, TLAdoubleHandle b); - TLAdoubleHandle mult_tl_adouble_double(TLAdoubleHandle a, double x); - - TLAdoubleHandle subtr_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - TLAdoubleHandle subtr_double_tl_adouble(double x, TLAdoubleHandle b); - TLAdoubleHandle subtr_tl_adouble_double(TLAdoubleHandle a, double x); - - TLAdoubleHandle div_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - TLAdoubleHandle div_double_tl_adouble(double x, TLAdoubleHandle b); - TLAdoubleHandle div_tl_adouble_double(TLAdoubleHandle a, double x); - - TLAdoubleHandle max_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - TLAdoubleHandle max_double_tl_adouble(double x, TLAdoubleHandle b); - TLAdoubleHandle max_tl_adouble_double(TLAdoubleHandle a, double x); - - TLAdoubleHandle min_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - TLAdoubleHandle min_double_tl_adouble(double x, TLAdoubleHandle b); - TLAdoubleHandle min_tl_adouble_double(TLAdoubleHandle a, double x); - - TLAdoubleHandle pow_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - TLAdoubleHandle pow_tl_adouble_double(TLAdoubleHandle a, double x); - - bool ge_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - bool ge_double_tl_adouble(double x, TLAdoubleHandle b); - bool ge_tl_adouble_double(TLAdoubleHandle a, double x); - - bool g_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - bool g_double_tl_adouble(double x, TLAdoubleHandle b); - bool g_tl_adouble_double(TLAdoubleHandle a, double x); - - bool le_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - bool le_double_tl_adouble(double x, TLAdoubleHandle b); - bool le_tl_adouble_double(TLAdoubleHandle a, double x); - - bool l_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - bool l_double_tl_adouble(double x, TLAdoubleHandle b); - bool l_tl_adouble_double(TLAdoubleHandle a, double x); - - bool eq_tl_adouble(TLAdoubleHandle a, TLAdoubleHandle b); - bool eq_double_tl_adouble(double x, TLAdoubleHandle b); - bool eq_tl_adouble_double(TLAdoubleHandle a, double x); - - TLAdoubleHandle tl_abs(TLAdoubleHandle a); - TLAdoubleHandle tl_sqrt(TLAdoubleHandle a); - TLAdoubleHandle tl_log(TLAdoubleHandle a); - TLAdoubleHandle tl_log10(TLAdoubleHandle a); - TLAdoubleHandle tl_sin(TLAdoubleHandle a); - TLAdoubleHandle tl_cos(TLAdoubleHandle a); - TLAdoubleHandle tl_tan(TLAdoubleHandle a); - TLAdoubleHandle tl_exp(TLAdoubleHandle a); - TLAdoubleHandle tl_asin(TLAdoubleHandle a); - TLAdoubleHandle tl_acos(TLAdoubleHandle a); - TLAdoubleHandle tl_atan(TLAdoubleHandle a); - TLAdoubleHandle tl_sinh(TLAdoubleHandle a); - TLAdoubleHandle tl_cosh(TLAdoubleHandle a); - TLAdoubleHandle tl_tanh(TLAdoubleHandle a); - TLAdoubleHandle tl_asinh(TLAdoubleHandle a); - TLAdoubleHandle tl_acosh(TLAdoubleHandle a); - TLAdoubleHandle tl_atanh(TLAdoubleHandle a); - TLAdoubleHandle tl_ceil(TLAdoubleHandle a); - TLAdoubleHandle tl_floor(TLAdoubleHandle a); - TLAdoubleHandle tl_ldexp(TLAdoubleHandle a, int n); - TLAdoubleHandle tl_erf(TLAdoubleHandle a); -#ifdef __cplusplus -} -#endif - -#endif // ADOLC_TL_INTERFACE_H \ No newline at end of file diff --git a/ADOL-C/c_interface/CMakeLists.txt b/ADOL-C/c_interface/CMakeLists.txt index 10d50d0a..0d142676 100644 --- a/ADOL-C/c_interface/CMakeLists.txt +++ b/ADOL-C/c_interface/CMakeLists.txt @@ -1,14 +1,13 @@ cmake_minimum_required(VERSION 3.27) -project(TestADOLC VERSION 1.0) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) add_library(ExternalADOLC SHARED IMPORTED) set_target_properties(ExternalADOLC PROPERTIES - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/libadolc.dylib" - INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/ADOL-C/include" + IMPORTED_LOCATION ${ADOLC_INSTALL_DIR}/lib/libadolc.dylib + INTERFACE_INCLUDE_DIRECTORIES ${ADOLC_INSTALL_DIR}/include ) -add_library(ADOLCInterface SHARED ADOLCTBInterface.cpp ADOLCTLInterface.cpp array_handler.cpp) +add_library(ADOLCInterface SHARED ADOLC_TB_interface.cpp ADOLC_TL_interface.cpp array_handler.cpp driver_interface.cpp) target_link_libraries(ADOLCInterface ExternalADOLC)