Skip to content
Merged
Changes from 1 commit
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
8 changes: 2 additions & 6 deletions R/get-pkgs.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ deepstate_get_mismatched_datatypes <- function(params.list){
params.list <-gsub(" ","",params.list)
datatypes <- list("NumericVector","NumericMatrix" ,"arma::mat","double",
"string","CharacterVector","int","IntegerVector")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is the list of supported data types right? So rather than "mismatched" in the function name maybe "unsupported" would be more appropriate?
Also this list is redundant with the logic in https://github.com/FabrizioSandri/RcppDeepState/blob/master/R/fun_harness_create.R -- if you have time it would be good to reorganize that code so that a list or table is used to lookup what to do, rather than the current code which is rather difficult to understand (lots of if/else statements).

@FabrizioSandri FabrizioSandri Jul 11, 2022

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

That's true, this list is redundant. I updated the deepstate_fun_create function inside fun_harness_create.R and replaced the if else statements with a table containing information for the supported datatypes. In detail each column of this table corresponds to a supported datatype and provides some details on it. The first row of this table contains an alternative datatype to be used when saving the inputs(e.g., using qs::c_qsave), whereas the second row correspond to the associated generation function that takes as input a range. When a datatype contains a value of NA in both rows, it means that is supported, utilizes itself when executing qs::c_qsave and lacks a range function. In this way checking if a datatype is supported is really simple: just check if exists a column for the datatype in this table.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I think the function deepstate_get_unsupported_datatypes may now be removed.

mismatched_datatypes <- list()
matched <- params.list %in% datatypes
if (!all(matched)){
mismatched_datatypes <- params.list[!matched]
}

mismatched_datatypes
matched <- params.list %in% datatypes
mismatched_datatypes <- params.list[!matched]

}

Expand Down