Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/RcppDeepState.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
pull_request:
branches:
- '*'

name: 'RcppDeepState analysis'
jobs:
RcppDeepState:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: FabrizioSandri/RcppDeepState-action@main
with:
fail_ci_if_error: true
seed: 5
time_limit_seconds: 60
max_inputs: 100
comment: true
verbose: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include <fstream>
#include <RInside.h>
#include <iostream>
#include <RcppDeepState.h>
#include <qs.h>
#include <DeepState.hpp>

RInside Rinstance;

/** FUNCTION SIGNATURE */
Rcpp::List binseg_interface(const Rcpp::NumericVector data_vec, const Rcpp::NumericVector weight_vec,
const int max_segments, const int min_segment_length, const std::string distribution_str,
const std::string container_str, const Rcpp::LogicalVector is_validation_vec, const Rcpp::NumericVector position_vec);

Rcpp::LogicalVector RcppDeepState_LogicalVector(int rand_size){
Rcpp::LogicalVector rand_vec(rand_size);
for(int i = 0 ; i < rand_size;i++){
rand_vec[i] = DeepState_IntInRange(0,1);
}

return rand_vec;
}

#define INPUTS \
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use a macro like this to avoid duplication in definition of data /generator code.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tdhock I have revised the harness creation procedure of RcppDeepState and made some additional improvements, including the use of macros. You can find these new changes in FabrizioSandri/RcppDeepState#16.

Before testing this change I have to merge FabrizioSandri/RcppDeepState#16 into the main branch. I will wait for your code review before merging these modifications, so that if something is wrong I can simply adjust.

int n_data = DeepState_IntInRange(1,1000); \
Rcpp::NumericVector data_vec = RcppDeepState_NumericVector(n_data, 0, 1000); \
Rcpp::NumericVector weight_vec = RcppDeepState_NumericVector(n_data, 0, 1000); \
int max_segments = RcppDeepState_int(1, n_data); \
int min_segment_length = RcppDeepState_int(1, 10); \
std::string distribution_str = "test"; \
std::string container_str = "test"; \
Rcpp::LogicalVector is_validation_vec = RcppDeepState_LogicalVector(n_data); \
Rcpp::NumericVector position_vec = RcppDeepState_NumericVector(n_data, 0, 1000);

TEST(binsegRcpp, generator){
INPUTS
}

TEST(binsegRcpp, runner){
INPUTS

/** INPUTS DUMP
Skipped: the final analysis table will contain an empty inputs column
*/

try{
binseg_interface(data_vec, weight_vec, max_segments,min_segment_length,
distribution_str, container_str, is_validation_vec, position_vec);

}catch(Rcpp::exception& e){
std::cout<<"Exception Handled"<<std::endl;
}
}
4 changes: 4 additions & 0 deletions src/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
Rcpp::NumericVector cum_median_interface
(Rcpp::NumericVector data_vec, Rcpp::NumericVector weight_vec){
int n_data = data_vec.size();
if(data_vec[0] > 0){
double *unused_ptr = new double[5];
unused_ptr[0] = data_vec[0];
}
if(weight_vec.size() != n_data){
Rcpp::stop("weight_vec must be same size as data_vec");
}
Expand Down