diff --git a/inst/include/Rcpp-adapters/FunctionsAdapter.hpp b/inst/include/Rcpp-adapters/FunctionsAdapter.hpp index 17cb7dc3..336b037f 100644 --- a/inst/include/Rcpp-adapters/FunctionsAdapter.hpp +++ b/inst/include/Rcpp-adapters/FunctionsAdapter.hpp @@ -22,25 +22,6 @@ namespace exageostat::adapters { - /** - * @brief Retrieves locations from ExaGeoStat data. - * @details Extracts and returns the locations stored in an ExaGeoStatData object, - * @param[in] apData Pointer to ExaGeoStatData object containing the spatial data. - * @return vector of locations coordinates. - * - */ - std::vector> R_GetLocations(ExaGeoStatData *apData); - - /** - * @brief Retrieves descriptive Z values from ExaGeoStat data based on type. - * @details Extracts and returns Z values from an ExaGeoStatData object, aiding in targeted spatial data analysis and visualization within ExaGeoStat. - * @param[in] apData Pointer to ExaGeoStatData object containing the spatial data. - * @param[in] aType String specifying the type of descriptor value to retrieve (e.g., "Chameleon", "HiCMA"). - * @return Numeric vector of descriptive Z values. - * - */ - Rcpp::NumericVector R_GetDescZValues(ExaGeoStatData *apData, const std::string &aType); - /** * @brief Function to load ExaGeoStat data. * @details This function loads data into an ExaGeoStatData object using the provided configuration and computational settings. @@ -60,7 +41,7 @@ namespace exageostat::adapters { * @return A pointer to an ExaGeoStatData object containing the loaded data. * */ - ExaGeoStatData * + Rcpp::List R_ExaGeoStatLoadData(const std::string &aKernelName, const std::vector &aInitialTheta, const std::string &aDistanceMatrix, const int &aProblemSize, const int &aSeed, const int &aDenseTileSize, const int &aLowTileSize, const std::string &aDimension, diff --git a/inst/include/utilities/Logger.hpp b/inst/include/utilities/Logger.hpp index 04fbb1c6..4e829306 100644 --- a/inst/include/utilities/Logger.hpp +++ b/inst/include/utilities/Logger.hpp @@ -31,17 +31,49 @@ #define DEFAULT_PRECISION 6 /** - * @def VERBOSE(msg) - * @brief Verbose macro for logging and debugging mode. + * @def VERBOSE_PRECISION + * @brief A fixed precision for the verbose mode. */ -#define VERBOSE(msg) \ +#define VERBOSE_PRECISION 12 + +/** + * @def VERBOSE_1(msg) + * @brief VERBOSE_1 macro for logging outputs in verbose mode, with double taps at the beginning, a fixed precision and a new line at the end. + */ +#define VERBOSE_1(msg) \ + if(exageostat::configurations::Configurations::GetVerbosity() == exageostat::common::Verbose::DETAILED_MODE && \ + !exageostat::helpers::CommunicatorMPI::GetInstance()->GetRank()) { \ + std::ostringstream oss; \ + oss << "\t\t " << std::fixed << std::setprecision(VERBOSE_PRECISION) << msg << std::endl; \ + std::cout << oss.str(); \ + } + +/** + * @def VERBOSE_2(msg, A) + * @brief VERBOSE_2 macro for logging outputs in verbose mode, with double taps at the beginning, a fixed precision and without a new line at the end. + */ +#define VERBOSE_2(msg, A) \ if(exageostat::configurations::Configurations::GetVerbosity() == exageostat::common::Verbose::DETAILED_MODE && \ !exageostat::helpers::CommunicatorMPI::GetInstance()->GetRank()) { \ std::ostringstream oss; \ - oss << "\t\t\t " << msg << std::endl; \ + oss << "\t\t " << std::fixed << std::setprecision(VERBOSE_PRECISION) << msg ; \ std::cout << oss.str(); \ } +/** + * @def VERBOSE_CONTROL(x, A, B, FUNC, ...) + * @brief VERBOSE_CONTROL is The internal macro that simply strips the excess and ends up with the required macro + */ +#define VERBOSE_CONTROL(x, A, B, FUNC, ...) FUNC + +/** + * @def VERBOSE(...) + * @brief VERBOSE macro that's called, Used to logging outputs in a verbose mode. + */ +#define VERBOSE(...) VERBOSE_CONTROL(,##__VA_ARGS__, \ + VERBOSE_2(__VA_ARGS__), \ + VERBOSE_1(__VA_ARGS__), \ + ) /** * @def LOGGER_1(msg) * @brief LOGGER_1 macro for logging outputs with double taps and new line at the end. diff --git a/man/get_Z_measurement_vector.Rd b/man/get_Z_measurement_vector.Rd index 5dc60933..b9a456bf 100644 --- a/man/get_Z_measurement_vector.Rd +++ b/man/get_Z_measurement_vector.Rd @@ -1,4 +1,3 @@ -// TODO: dots % Copyright (c) 2017-2024 King Abdullah University of Science and Technology, % All rights reserved. % ExaGeoStat is a software package, provided by King Abdullah University of Science and Technology (KAUST). diff --git a/scripts/Benchmarking.sh b/scripts/Benchmarking.sh index ac72b5f6..6acb651e 100644 --- a/scripts/Benchmarking.sh +++ b/scripts/Benchmarking.sh @@ -47,13 +47,13 @@ for N in "${desired_N[@]}"; do time_prediction=$(echo "$time_prediction" | tr -d '\n' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') time_modeling_iteration=$(echo "$command_output" | awk -F "#Average Time Modeling per Iteration: " '{print $2}' | awk -F "," '{print $1}') time_modeling_iteration=$(echo "$time_modeling_iteration" | tr -d '\n' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - flops_generation=$(echo "$command_output" | awk -F "#Total Data Generation Gflop/s: " '{print $2}' | awk -F "," '{print $1}') + flops_generation=$(echo "$command_output" | awk -F "#Total Data Generation GFlop/s: " '{print $2}' | awk -F "," '{print $1}') flops_generation=$(echo "$flops_generation" | tr -d '\n' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - flops_modeling=$(echo "$command_output" | awk -F "#Total MLE Gflop/s: " '{print $2}' | awk -F "," '{print $1}') + flops_modeling=$(echo "$command_output" | awk -F "#Total MLE GFlop/s: " '{print $2}' | awk -F "," '{print $1}') flops_modeling=$(echo "$flops_modeling" | tr -d '\n' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') flops_modeling_iteration=$(echo "$command_output" | awk -F "#Average Flops per Iteration: " '{print $2}' | awk -F "," '{print $1}') flops_modeling_iteration=$(echo "$flops_modeling_iteration" | tr -d '\n' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') - flops_mspe=$(echo "$command_output" | awk -F "#MSPE Gflop/s: " '{print $2}' | awk -F "," '{print $1}') + flops_mspe=$(echo "$command_output" | awk -F "#MSPE GFlop/s: " '{print $2}' | awk -F "," '{print $1}') flops_mspe=$(echo "$flops_mspe" | tr -d '\n' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') echo "$command_output" diff --git a/src/Rcpp-adapters/FunctionsAdapter.cpp b/src/Rcpp-adapters/FunctionsAdapter.cpp index 4d5407ae..99560eca 100644 --- a/src/Rcpp-adapters/FunctionsAdapter.cpp +++ b/src/Rcpp-adapters/FunctionsAdapter.cpp @@ -25,60 +25,7 @@ using namespace exageostat::configurations; namespace exageostat::adapters { - vector> R_GetLocations(ExaGeoStatData *apData) { - - // Number of points per each dimension - int length = apData->GetLocations()->GetSize(); - bool is3D = apData->GetLocations()->GetDimension() == Dimension3D; - - double *locationXArray = apData->GetLocations()->GetLocationX(); - double *locationYArray = apData->GetLocations()->GetLocationY(); - double *locationZArray = nullptr; - if (is3D) { - locationZArray = apData->GetLocations()->GetLocationZ(); - } - - vector> locations_matrix; - for (int i = 0; i < length; ++i) { - vector point; - point.push_back(locationXArray[i]); - point.push_back(locationYArray[i]); - if (is3D) { - point.push_back(locationZArray[i]); - } - locations_matrix.push_back(point); - } - return locations_matrix; - } - - NumericVector R_GetDescZValues(ExaGeoStatData *apData, const string &aType) { - - DescriptorType descriptorType; - void *pDescriptor; - - if (aType == "chameleon" || aType == "Chameleon") { - descriptorType = CHAMELEON_DESCRIPTOR; - } else if (aType == "hicma" || aType == "Hicma" || aType == "HICMA") { -#ifdef USE_HICMA - descriptorType = HICMA_DESCRIPTOR; -#else - throw runtime_error("Please enable HiCMA to use HiCMA descriptors."); -#endif - } else { - throw domain_error("Invalid type of descriptor, please use chameleon or hicma."); - } - - // Obtain the pointer to the array of doubles - double *data = apData->GetDescriptorData()->GetDescriptorMatrix(descriptorType, DESCRIPTOR_Z); - int length = apData->GetLocations()->GetSize(); - // Create an empty NumericVector of the appropriate length - NumericVector vec(length); - // Copy data from the double array to the NumericVector - copy(data, data + length, vec.begin()); - return vec; - } - - ExaGeoStatData * + List R_ExaGeoStatLoadData(const string &aKernelName, const vector &aInitialTheta, const string &aDistanceMatrix, const int &aProblemSize, const int &aSeed, const int &aDenseTileSize, const int &aLowTileSize, const string &aDimension, const string &aLogPath, const string &aDataPath, @@ -110,8 +57,59 @@ namespace exageostat::adapters { unique_ptr> data; ExaGeoStat::ExaGeoStatLoadData(configurations, data); + // Obtain the pointer to the array of doubles + double *descriptor_data = data->GetDescriptorData()->GetDescriptorMatrix(CHAMELEON_DESCRIPTOR, DESCRIPTOR_Z); + int length = data->GetLocations()->GetSize(); + // Create an empty NumericVector of the appropriate length + NumericVector vec(length); + // Copy data from the double array to the NumericVector + copy(descriptor_data, descriptor_data + length, vec.begin()); + + // Number of points per each dimension + bool is3D = data->GetLocations()->GetDimension() == Dimension3D; + + double *locationXArray = data->GetLocations()->GetLocationX(); + double *locationYArray = data->GetLocations()->GetLocationY(); + double *locationZArray = nullptr; + if (is3D) { + locationZArray = data->GetLocations()->GetLocationZ(); + } + + vector> locations_matrix; + for (int i = 0; i < length; ++i) { + vector point; + point.push_back(locationXArray[i]); + point.push_back(locationYArray[i]); + if (is3D) { + point.push_back(locationZArray[i]); + } + locations_matrix.push_back(point); + } + + // Create NumericVectors for location coordinates + NumericVector locationX(length); + NumericVector locationY(length); + NumericVector locationZ(length); + + for (int i = 0; i < length; ++i) { + locationX[i] = locationXArray[i]; + locationY[i] = locationYArray[i]; + if (is3D) { + locationZ[i] = locationZArray[i]; + } + } + + // Create a list of vectors including z_values and locations + Rcpp::List result = Rcpp::List::create( + _["m"] = vec, + _["x"] = locationX, + _["y"] = locationY, + _["z"] = locationZ + ); // We can safely return the raw pointer, but we need to release it from data to avoid deletion. - return data.release(); + data.release(); + + return result; } vector diff --git a/src/Rcpp-adapters/RcppModules.cpp b/src/Rcpp-adapters/RcppModules.cpp index b56b3154..17c9036d 100644 --- a/src/Rcpp-adapters/RcppModules.cpp +++ b/src/Rcpp-adapters/RcppModules.cpp @@ -66,8 +66,4 @@ RCPP_MODULE(ExaGeoStatCPP) { List::create(_["kernel"], _["distance_matrix"] = "euclidean", _["estimated_theta"], _["dts"], _["lts"] = 0, _["dimension"] = "2D", _["train_data"], _["test_data"], _["test_measurements"])); - function("get_locations", &exageostat::adapters::R_GetLocations, List::create(_["data"])); - - function("get_Z_measurement_vector", &exageostat::adapters::R_GetDescZValues, List::create(_["data"], _["type"])); - } diff --git a/src/api/ExaGeoStat.cpp b/src/api/ExaGeoStat.cpp index 830aa481..e1f1b1d1 100644 --- a/src/api/ExaGeoStat.cpp +++ b/src/api/ExaGeoStat.cpp @@ -71,6 +71,18 @@ T ExaGeoStat::ExaGeoStatDataModeling(Configurations &aConfigurations, std::un optimizing_function.optimize(aConfigurations.GetStartingTheta(), opt_f); aConfigurations.SetEstimatedTheta(aConfigurations.GetStartingTheta()); + auto theta = aConfigurations.GetStartingTheta(); + + LOGGER("--> Final Theta Values (", true) + for (int i = 0; i < parameters_number; i++) { + LOGGER_PRECISION(theta[i]) + if (i != parameters_number - 1) { + LOGGER_PRECISION(", ") + } + } + LOGGER_PRECISION(")") + LOGGER("") + delete pKernel; delete modeling_data; return optimizing_function.last_optimum_value(); diff --git a/src/configurations/Configurations.cpp b/src/configurations/Configurations.cpp index b3b430f6..8da6a38f 100644 --- a/src/configurations/Configurations.cpp +++ b/src/configurations/Configurations.cpp @@ -623,6 +623,7 @@ void Configurations::InitTheta(vector &aTheta, const int &size) { void Configurations::PrintSummary() { +#ifndef USING_R Verbose temp = this->GetVerbosity(); mVerbosity = STANDARD_MODE; @@ -674,9 +675,10 @@ void Configurations::PrintSummary() { LOGGER("#Out Of Core (OOC) technology is enabled") } LOGGER("*************************************************") - mVerbosity = temp; mFirstInit = true; } + mVerbosity = temp; +#endif } int Configurations::CalculateZObsNumber() { diff --git a/src/linear-algebra-solvers/LinearAlgebraMethods.cpp b/src/linear-algebra-solvers/LinearAlgebraMethods.cpp index f2d98acb..31931325 100644 --- a/src/linear-algebra-solvers/LinearAlgebraMethods.cpp +++ b/src/linear-algebra-solvers/LinearAlgebraMethods.cpp @@ -813,16 +813,16 @@ void LinearAlgebraMethods::ExaGeoStatMLETileMLOEMMOM(Configurations &aConfigu int n_z_miss = aConfigurations.GetUnknownObservationsNb(); int num_par = aKernel.GetParametersNumbers(); - LOGGER("\t\t- Truth Theta: ", true) + VERBOSE("\t\t- Truth Theta: ", true) for (int num = 0; num < num_par; num++) { - LOGGER_PRECISION(apTruthTheta[num] << " ") + VERBOSE(apTruthTheta[num] << " ",true) } - LOGGER("") - LOGGER("\t\t- Estimated Theta: ", true) + VERBOSE("") + VERBOSE("\t\t- Estimated Theta: ", true) for (int num = 0; num < num_par; num++) { - LOGGER_PRECISION(apEstimatedTheta[num] << " ") + VERBOSE(apEstimatedTheta[num] << " ",true) } - LOGGER("") + VERBOSE("") int p; double all_time, cholesky1, cholesky2, matrix_gen, vecs_gen, copy_vecs, trsm1, trsm2, trsm3, trsm4, gevv1, gevv2, gevv3, gevv4, gevv5; @@ -1109,7 +1109,7 @@ void LinearAlgebraMethods::ExaGeoStatMLETileMLOEMMOM(Configurations &aConfigu *mloe /= n_z_miss; *mmom /= n_z_miss; STOP_TIMING(all_time); - LOGGER("\t\t- MLOE = " << *mloe << "\t\t- MMOM = " << *mmom) + VERBOSE("\t\t- MLOE = " << *mloe << "\t\t- MMOM = " << *mmom) VERBOSE("\t---- MLOE MMOM Time: " << all_time << " seconds.") Results::GetInstance()->SetMLOE(*mloe); diff --git a/src/prediction/Prediction.cpp b/src/prediction/Prediction.cpp index 2cf565c2..c5b625b7 100644 --- a/src/prediction/Prediction.cpp +++ b/src/prediction/Prediction.cpp @@ -93,16 +93,16 @@ void Prediction::PredictMissingData(unique_ptr> &aData, Con VERBOSE("\t\t- CI for nu: " << aConfigurations.GetEstimatedTheta()[2] - Q_NORM * sqrt(fisher_results[8]) << " " << aConfigurations.GetEstimatedTheta()[2] + Q_NORM * sqrt(fisher_results[8])) - LOGGER("\t\t- Fisher Matrix:") + VERBOSE("\t\t- Fisher Matrix:") for (i = 0; i < num_params; i++) { - LOGGER("\t\t ", true) + VERBOSE("\t\t ", true) for (j = 0; j < num_params; j++) { - LOGGER_PRECISION(fisher_results[i * num_params + j], 18) + VERBOSE(fisher_results[i * num_params + j],true) if (j != num_params - 1) { - LOGGER_PRECISION(", ") + VERBOSE(", ",true) } } - LOGGER("") + VERBOSE("") } delete[] fisher_results; } @@ -159,7 +159,7 @@ void Prediction::PredictMissingData(unique_ptr> &aData, Con // MSPE Prediction Function Call if (aConfigurations.GetIsMSPE()) { - LOGGER("\t---- Using MSPE ----") + LOGGER("\t---- Using Prediction Function MSPE ----") T *prediction_error_mspe; if (aConfigurations.GetIsNonGaussian()) { prediction_error_mspe = linear_algebra_solver->ExaGeoStatMLENonGaussianPredictTile(aData, @@ -187,7 +187,7 @@ void Prediction::PredictMissingData(unique_ptr> &aData, Con } Results::GetInstance()->SetPredictedMissedValues(z_miss_vector); if (z_actual) { - LOGGER("\t\t- MSPE: " << avg_pred_value[0]) + LOGGER("\t\t- Prediction value: " << avg_pred_value[0]) } delete[] prediction_error_mspe; } diff --git a/src/prediction/PredictionAuxiliaryFunctions.cpp b/src/prediction/PredictionAuxiliaryFunctions.cpp index 1dc84d28..b39438ec 100644 --- a/src/prediction/PredictionAuxiliaryFunctions.cpp +++ b/src/prediction/PredictionAuxiliaryFunctions.cpp @@ -61,5 +61,5 @@ void PredictionAuxiliaryFunctions::PredictIDW(T *apZMiss, T *apZActual, T *ap for (int index = 0; index < aZMissNumber; index++) { VERBOSE(" (" << apZActual[index] << ", " << apZMiss[index] << ")") } - LOGGER("\t\t- Prediction Error (IDW): " << apMSPE[0] << " - " << apMSPE[1] << " - " << apMSPE[2]) + VERBOSE("\t\t- Prediction Error (IDW): " << apMSPE[0] << " - " << apMSPE[1] << " - " << apMSPE[2]) } \ No newline at end of file diff --git a/tests/R-tests/TestDataGeneration.R b/tests/R-tests/TestDataGeneration.R index 50955842..5ee9f2cc 100644 --- a/tests/R-tests/TestDataGeneration.R +++ b/tests/R-tests/TestDataGeneration.R @@ -40,9 +40,14 @@ hardware <- new(Hardware, computation, ncores, ngpus, p, q) exageostat_data <- simulate_data(kernel=kernel, initial_theta=initial_theta, problem_size=problem_size, dts=dts, dimension=dimension, log_path=log_path) # Print the data.. -paste("** Locations X - Y - Z") -locations <- get_locations(data=exageostat_data) -paste(locations) +paste("Z Values") +paste(exageostat_data$m) +paste("Locations X") +paste(exageostat_data$x) +paste("Locations Y") +paste(exageostat_data$y) +paste("Locations Z") +paste(exageostat_data$z) paste("---------------------------------------------------------------------------------------------") paste("ExaGeoStat with Data Generation - Reading Data") @@ -52,6 +57,13 @@ data_path <- "./synthetic_ds/SYN_16_1" exageostat_data <- simulate_data(kernel=kernel, initial_theta=initial_theta, problem_size=problem_size, dts=dts, dimension=dimension, data_path=data_path) -paste("** Locations X - Y - Z - after reading") -locations <- get_locations(data=exageostat_data) -paste(locations) \ No newline at end of file +paste("** after reading") +# Print the data.. +paste("Z Values") +paste(exageostat_data$m) +paste("Locations X") +paste(exageostat_data$x) +paste("Locations Y") +paste(exageostat_data$y) +paste("Locations Z") +paste(exageostat_data$z) diff --git a/tests/R-tests/TestDataModeling.R b/tests/R-tests/TestDataModeling.R index f0b1567d..3acebcf8 100644 --- a/tests/R-tests/TestDataModeling.R +++ b/tests/R-tests/TestDataModeling.R @@ -61,8 +61,7 @@ lts <- 8 computation <- "tlr" hardware <- new(Hardware, computation, ncores, ngpus, 1, 1) -empty_data <- new(Data, problem_size, dimension) -theta <- model_data(matrix=z_value, x=locations_x, y=locations_y, kernel=kernel, dts=dts, lts=lts, dimension=dimension,lb=lower_bound, ub=upper_bound, mle_itr=10, computation=computation) +theta <- model_data(matrix=z_value, x=locations_x, y=locations_y, kernel=kernel, dts=dts, lts=lts, dimension=dimension,lb=lower_bound, ub=upper_bound, mle_itr=10, computation=computation, band=1) hardware$finalize_hardware() paste("---------------------------------------------------------------------------------------------") @@ -71,6 +70,5 @@ paste("ExaGeoStat with data Modeling only - exact") lts <- 0 computation <- "exact" -empty_data <- new(Data, problem_size, dimension) hardware <- new(Hardware, computation, ncores, ngpus, 1, 1) theta <- model_data(matrix=z_value, x=locations_x, y=locations_y, kernel=kernel, dts=dts, dimension=dimension,lb=lower_bound, ub=upper_bound, mle_itr=10, computation=computation) diff --git a/tests/R-tests/TestExaGeoStatAPI.R b/tests/R-tests/TestExaGeoStatAPI.R index 618c2c2c..9d1328fe 100644 --- a/tests/R-tests/TestExaGeoStatAPI.R +++ b/tests/R-tests/TestExaGeoStatAPI.R @@ -31,12 +31,11 @@ q <- 1 hardware <- new(Hardware, computation, ncores, ngpus, p, q) exageostat_data <- simulate_data(kernel=kernel, initial_theta=initial_theta, problem_size=problem_size, dts=dts, dimension=dimension) -estimated_theta <- model_data(data=exageostat_data, kernel=kernel, dts=dts, dimension=dimension,lb=lower_bound, ub=upper_bound, mle_itr=10) +estimated_theta <- model_data(matrix=exageostat_data$m, x=exageostat_data$x, y=exageostat_data$y, kernel=kernel, dts=dts, dimension=dimension,lb=lower_bound, ub=upper_bound, mle_itr=10) test_x <- c(0.2, 0.330) test_y <- c(0.104, 0.14) -locations = get_locations(data=exageostat_data) -predict_data(train_data=list(sapply(locations, function(v) v[1]), sapply(locations, function(v) v[2]), get_Z_measurement_vector(data=exageostat_data, type="chameleon")), test_data=list(test_x, test_y), kernel=kernel, dts=dts, estimated_theta=estimated_theta) +predict_data(train_data=list(x=exageostat_data$x, y=exageostat_data$y, exageostat_data$m), test_data=list(test_x, test_y), kernel=kernel, dts=dts, estimated_theta=estimated_theta) paste("---------------------------------------------------------------------------------------------") paste("ExaGeoStat with Data Generation only") diff --git a/tests/cpp-tests/Rcpp-adapters/TestAllRFunctions.cpp b/tests/cpp-tests/Rcpp-adapters/TestAllRFunctions.cpp index 38f193e3..62f3b7df 100644 --- a/tests/cpp-tests/Rcpp-adapters/TestAllRFunctions.cpp +++ b/tests/cpp-tests/Rcpp-adapters/TestAllRFunctions.cpp @@ -24,40 +24,6 @@ using namespace std; using namespace exageostat::adapters; using namespace exageostat::common; -void TEST_DATA_GENERATION() { - - const string computation = "exact"; - const string dimension = "2D"; - const string kernel = "univariate_matern_stationary"; - const string distance_matrix = "eg"; - const int cores_number = 1; - const int gpus_number = 0; - const int problem_size = 9; - const int dts = 3; - const int lts = 0; - const vector initial_theta = {1, 0.1, 0.5}; - const vector lower_bound = {0.1, 0.1, 0.1}; - const vector upper_bound = {5, 5, 5}; - const vector estimated_theta = {0.9, 0.2, 0.5}; - srand(0); - - auto hardware = ExaGeoStatHardware(computation, cores_number, gpus_number); - auto exageostat_data = R_ExaGeoStatLoadData(kernel, initial_theta, distance_matrix, problem_size, 0, dts, lts, - dimension, "", "", "", ""); - - vector x = {0.257389, 0.456062, 0.797269, 0.242161, 0.440742, 0.276432, 0.493965, 0.953933, 0.86952}; - vector y = {0.138506, 0.238193, 0.170245, 0.579583, 0.514397, 0.752682, 0.867704, 0.610986, 0.891279}; - vector z = {-1.27234, -2.47547, 0.54585, -0.120985, 0.242569, -1.54421, 0.0986468, 0.779835, -1.48139}; - - for (int i = 0; i < problem_size; i++) { - REQUIRE((exageostat_data->GetLocations()->GetLocationX()[i] - x[i]) == Catch::Approx(0.0).margin(1e-6)); - REQUIRE((exageostat_data->GetLocations()->GetLocationY()[i] - y[i]) == Catch::Approx(0.0).margin(1e-6)); - REQUIRE((exageostat_data->GetDescriptorData()->GetDescriptorMatrix(CHAMELEON_DESCRIPTOR, DESCRIPTOR_Z)[i] - - z[i]) == Catch::Approx(0.0).margin(1e-5)); - } - delete exageostat_data; -} - void TEST_ALL_R_METHODS() { const string computation = "exact"; @@ -164,6 +130,5 @@ void TEST_ALL_R_METHODS() { } TEST_CASE("Test R/Rcpp adapters in C++") { - TEST_DATA_GENERATION(); TEST_ALL_R_METHODS(); } \ No newline at end of file