Skip to content

Commit

Permalink
Fixes and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
2005m committed Apr 25, 2024
1 parent 7814227 commit 2d218e7
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 49 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: kit
Type: Package
Title: Data Manipulation Functions Implemented in C
Version: 0.0.16
Date: 2024-03-01
Version: 0.0.17
Date: 2024-04-25
Authors@R: c(person("Morgan", "Jacob", role = c("aut", "cre", "cph"), email = "[email protected]"),
person("Sebastian", "Krantz", role = "ctb"))
Author: Morgan Jacob [aut, cre, cph], Sebastian Krantz [ctb]
Expand Down
2 changes: 1 addition & 1 deletion R/call.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ vswitch = function(x, values, outputs, default=NULL, nThread=getOption("kit.
omp = if(.Call(CompEnabledR)) "enabled" else "disabled" #nocov
nth = getOption("kit.nThread") #nocov
thd = if (nth > 1L) " threads)" else " thread)" #nocov
packageStartupMessage(paste0("Attaching kit 0.0.16 (OPENMP ",omp," using ",nth,thd)) #nocov
packageStartupMessage(paste0("Attaching kit 0.0.17 (OPENMP ",omp," using ",nth,thd)) #nocov
} #nocov

.onLoad = function(libname, pkgname) { #nocov
Expand Down
13 changes: 13 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@

\newcommand{\CRANpkg}{\href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}}

\section{version 0.0.17 (2024-04-25)}{
\subsection{Bug Fixes}{
\itemize{
\item Fix \code{nswitch}. Thanks to Sebastian Krantz for raising an issue.
}
}
\subsection{Notes}{
\itemize{
\item Update copyright date in c files
}
}
}

\section{version 0.0.16 (2024-03-01)}{
\subsection{Notes}{
\itemize{
Expand Down
2 changes: 1 addition & 1 deletion src/dup.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* kit : Useful R Functions Implemented in C
* Copyright (C) 2020-2021 Morgan Jacob
* Copyright (C) 2020-2024 Morgan Jacob
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/dupLen.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* kit : Useful R Functions Implemented in C
* Copyright (C) 2020-2021 Morgan Jacob
* Copyright (C) 2020-2024 Morgan Jacob
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/fpos.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* kit : Useful R Functions Implemented in C
* Copyright (C) 2020-2021 Morgan Jacob
* Copyright (C) 2020-2024 Morgan Jacob
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/iif.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* kit : Useful R Functions Implemented in C
* Copyright (C) 2020-2021 Morgan Jacob
* Copyright (C) 2020-2024 Morgan Jacob
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
72 changes: 36 additions & 36 deletions src/nswitch.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* kit : Useful R Functions Implemented in C
* Copyright (C) 2020-2021 Morgan Jacob
* Copyright (C) 2020-2024 Morgan Jacob
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -151,7 +151,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = LOGICAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -164,7 +164,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = INTEGER(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -177,7 +177,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const double *restrict pvalues = REAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -190,7 +190,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const Rcomplex *restrict pvalues = COMPLEX(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (EQUAL_CPLX(px[j], pvalues[0])) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -203,7 +203,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = STRING_PTR(utfcon ? vans : PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand Down Expand Up @@ -244,7 +244,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = LOGICAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -257,7 +257,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = INTEGER(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -270,7 +270,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const double *restrict pvalues = REAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -283,7 +283,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const Rcomplex *restrict pvalues = COMPLEX(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (EQUAL_CPLX(px[j], pvalues[0])) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -296,7 +296,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = STRING_PTR(utfcon ? vans : PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -308,7 +308,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = SEXPPTR_RO(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (R_compute_identical(px[j],pvalues[0],0)) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand Down Expand Up @@ -337,7 +337,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = LOGICAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -350,7 +350,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = INTEGER(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -363,7 +363,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const double *restrict pvalues = REAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -376,7 +376,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const Rcomplex *restrict pvalues = COMPLEX(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (EQUAL_CPLX(px[j], pvalues[0])) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -389,7 +389,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = STRING_PTR(utfcon ? vans : PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -401,7 +401,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = SEXPPTR_RO(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (R_compute_identical(px[j],pvalues[0],0)) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand Down Expand Up @@ -431,7 +431,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = LOGICAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -444,7 +444,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = INTEGER(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -457,7 +457,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const double *restrict pvalues = REAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -470,7 +470,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const Rcomplex *restrict pvalues = COMPLEX(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (EQUAL_CPLX(px[j],pvalues[0])) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -483,7 +483,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = STRING_PTR(utfcon ? vans : PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -495,7 +495,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = SEXPPTR_RO(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (R_compute_identical(px[j],pvalues[0],0)) {
pans[j] = pto[i & amask[i]];
pans[j] = pto[j & amask[i]];
}
}
}
Expand All @@ -521,7 +521,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = LOGICAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
SET_STRING_ELT(ans, j, pto[i & amask[i]]);
SET_STRING_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -533,7 +533,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = INTEGER(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
SET_STRING_ELT(ans, j, pto[i & amask[i]]);
SET_STRING_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -545,7 +545,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const double *restrict pvalues = REAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
SET_STRING_ELT(ans, j, pto[i & amask[i]]);
SET_STRING_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -557,7 +557,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const Rcomplex *restrict pvalues = COMPLEX(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (EQUAL_CPLX(px[j],pvalues[0])) {
SET_STRING_ELT(ans, j, pto[i & amask[i]]);
SET_STRING_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -569,7 +569,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = STRING_PTR(utfcon ? vans : PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
SET_STRING_ELT(ans, j, pto[i & amask[i]]);
SET_STRING_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -581,7 +581,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = SEXPPTR_RO(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (R_compute_identical(px[j],pvalues[0],0)) {
SET_STRING_ELT(ans, j, pto[i & amask[i]]);
SET_STRING_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand Down Expand Up @@ -609,7 +609,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = LOGICAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
SET_VECTOR_ELT(ans, j, pto[i & amask[i]]);
SET_VECTOR_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -621,7 +621,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const int *restrict pvalues = INTEGER(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
SET_VECTOR_ELT(ans, j, pto[i & amask[i]]);
SET_VECTOR_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -633,7 +633,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const double *restrict pvalues = REAL(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
SET_VECTOR_ELT(ans, j, pto[i & amask[i]]);
SET_VECTOR_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -645,7 +645,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const Rcomplex *restrict pvalues = COMPLEX(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (EQUAL_CPLX(px[j], pvalues[0])) {
SET_VECTOR_ELT(ans, j, pto[i & amask[i]]);
SET_VECTOR_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -657,7 +657,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = STRING_PTR(utfcon ? vans : PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (px[j] == pvalues[0]) {
SET_VECTOR_ELT(ans, j, pto[i & amask[i]]);
SET_VECTOR_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand All @@ -669,7 +669,7 @@ SEXP nswitchR(SEXP x, SEXP na, SEXP nthreads, SEXP chkenc, SEXP args) {
const SEXP *restrict pvalues = SEXPPTR_RO(PTR_ETL(args, 2*i));
for (ssize_t j = 0; j < len_x; ++j) {
if (R_compute_identical(px[j],pvalues[0],0)) {
SET_VECTOR_ELT(ans, j, pto[i & amask[i]]);
SET_VECTOR_ELT(ans, j, pto[j & amask[i]]);
}
}
}
Expand Down
Loading

0 comments on commit 2d218e7

Please sign in to comment.