From dee3b28ebe0c53d4f901a675d46eff7d7a126c55 Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Mon, 27 May 2024 15:55:37 -0500 Subject: [PATCH] Use Rf_error --- R/rxSymInv.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/rxSymInv.R b/R/rxSymInv.R index 61d4371c1..06c634039 100644 --- a/R/rxSymInv.R +++ b/R/rxSymInv.R @@ -202,7 +202,7 @@ rxSymInvC2 <- function(mat1, diag.xform = c("sqrt", "log", "identity"), matExpr <- sprintf(" if (theta_n >= -1){\n SEXP ret = PROTECT(Rf_allocMatrix(REALSXP, %s, %s));for (int i = 0; i < %s; i++){REAL(ret)[i]=0;}\n", d, d, d * d) vecExpr <- sprintf(" UNPROTECT(1);\n return(ret);\n } else {\n SEXP ret = PROTECT(Rf_allocVector(REALSXP, %s));for(int i = 0; i < %s; i++){REAL(ret)[i]=0;}\n%s\n UNPROTECT(1);\n return(ret);\n }", d, d, diag) src <- sprintf( - " int theta_n = INTEGER(tn)[0];\n %s\nif (theta_n == -2){\n SEXP ret = PROTECT(Rf_allocVector(INTSXP, 1));\n INTEGER(ret)[0] = %s;\n UNPROTECT(1);\n return ret;\n }\n else if (theta_n < %s || theta_n > %s){\n error(\"d(Omega^-1) derivative outside bounds\");\n }\n else if (Rf_length(theta) != %s){\n error(\"requires vector with %s arguments\");\n }\n%s\n%s\n%s", + " int theta_n = INTEGER(tn)[0];\n %s\nif (theta_n == -2){\n SEXP ret = PROTECT(Rf_allocVector(INTSXP, 1));\n INTEGER(ret)[0] = %s;\n UNPROTECT(1);\n return ret;\n }\n else if (theta_n < %s || theta_n > %s){\n Rf_error(\"d(Omega^-1) derivative outside bounds\");\n }\n else if (Rf_length(theta) != %s){\n Rf_error(\"requires vector with %s arguments\");\n }\n%s\n%s\n%s", mat2, length(vars), min(diags) - 1, length(vars), length(vars), length(vars), paste0(matExpr, omega0), omega1, paste0(omega1p, "\n", vecExpr) )