Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use internal functions for some specialized case? #3

Open
skanskan opened this issue Nov 22, 2019 · 1 comment
Open

How to use internal functions for some specialized case? #3

skanskan opened this issue Nov 22, 2019 · 1 comment

Comments

@skanskan
Copy link

skanskan commented Nov 22, 2019

Hello.

I need to calculate millions of times something like this:

x <- c("a", "b", "c", "d", "e", "f", "g","h", "i", "j")  # short vectors of letters
combinations(v=x, k=2)     # k is going to be always 2.

and

y <- 1:10    # short vectors of integers. And specifically sequences.
permutations(v=y)

How can directly use the internal specific functions for my case instead of the generic "permutations" and "combinations", which do many checks and eventually use some specialized function?
For example I've seen in the code there are functions with names such as "n_multiset_combinations".
My intention is to do it as fast as possible, without unnecesary checks because I know the inputs are going to be the proper ones.

@randy3k
Copy link
Owner

randy3k commented Nov 22, 2019

The validation and dispatching are done in c. It should be only a little head over even if you do it a million times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants