This repository has been archived by the owner on Feb 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* reimplement row min in C * added registration
- Loading branch information
1 parent
bc06964
commit 45b0dbd
Showing
8 changed files
with
50 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,5 @@ Imports: | |
purrr, | ||
quanteda, | ||
Matrix, | ||
utils, | ||
Rcpp | ||
utils | ||
VignetteBuilder: knitr | ||
LinkingTo: | ||
Rcpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
## usethis namespace: start | ||
#' @importFrom Rcpp sourceCpp | ||
#' @useDynLib quanteda.proximity, .registration = TRUE | ||
## usethis namespace: end | ||
NULL |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <R.h> | ||
#include <R_ext/Rdynload.h> | ||
#include <Rinternals.h> | ||
|
||
SEXP row_mins_(SEXP mat, SEXP nRows, SEXP nCols) { | ||
int nrows = INTEGER(nRows)[0]; | ||
int ncols = INTEGER(nCols)[0]; | ||
SEXP mins = PROTECT(allocVector(INTSXP, nrows)); | ||
int *pmat = INTEGER(mat); | ||
int *pmins = INTEGER(mins); | ||
|
||
for (int i = 0; i < nrows; i++) { | ||
int minVal = pmat[i]; | ||
for (int j = 1; j < ncols; j++) { | ||
int currentVal = pmat[i + j * nrows]; | ||
if (currentVal < minVal) { | ||
minVal = currentVal; | ||
} | ||
} | ||
pmins[i] = minVal; | ||
} | ||
|
||
UNPROTECT(1); | ||
return mins; | ||
} | ||
|
||
void R_init_row_mins_(DllInfo *info) { | ||
R_registerRoutines(info, NULL, NULL, NULL, NULL); | ||
R_useDynamicSymbols(info, TRUE); | ||
} |
This file was deleted.
Oops, something went wrong.