[r-cran-mnp] 25/51: Import Upstream version 2.3-9

Andreas Tille tille at debian.org
Fri Sep 8 14:14:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-mnp.

commit 9e4241f107417472356f42a7b5ed68a4f8998fa9
Author: Andreas Tille <tille at debian.org>
Date:   Fri Sep 8 15:54:52 2017 +0200

    Import Upstream version 2.3-9
---
 DESCRIPTION                |   6 +--
 R/{onLoad.R => onAttach.R} |   2 +-
 man/mnp.Rd                 |   8 ++--
 src/vector.c               | 107 ++++++++++++++++++++++++++++-----------------
 src/vector.h               |  13 +++---
 5 files changed, 81 insertions(+), 55 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 48cd9eb..f730a4b 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: MNP
-Version: 2.3-8
-Date: 2006-4-26
+Version: 2.3-9
+Date: 2006-9-21
 Title: R Package for Fitting the Multinomial Probit Model
 Author: Kosuke Imai <kimai at princeton.edu>, 
         David A. van Dyk <dvd at uci.edu>. 
@@ -24,4 +24,4 @@ LazyLoad: yes
 LazyData: yes
 License: GPL (version 2 or later)
 URL: http://imai.princeton.edu/research/MNP.html
-Packaged: Wed Apr 26 07:21:06 2006; kimai
+Packaged: Thu Sep 21 09:48:21 2006; kimai
diff --git a/R/onLoad.R b/R/onAttach.R
similarity index 86%
rename from R/onLoad.R
rename to R/onAttach.R
index 7422664..64fee23 100644
--- a/R/onLoad.R
+++ b/R/onAttach.R
@@ -1,4 +1,4 @@
-".onLoad" <- function(lib, pkg) {
+".onAttach" <- function(lib, pkg) {
   mylib <- dirname(system.file(package = pkg))
   title <- packageDescription(pkg, lib = mylib)$Title
   ver <- packageDescription(pkg, lib = mylib)$Version
diff --git a/man/mnp.Rd b/man/mnp.Rd
index 25d2aa1..113edbd 100644
--- a/man/mnp.Rd
+++ b/man/mnp.Rd
@@ -11,7 +11,8 @@
   with different choice sets for each observation, and complete or
   partial ordering of all the available alternatives. The computation
   uses the efficient marginal data augmentation algorithm that is
-  developed by Imai and van Dyk (2005a).  }
+  developed by Imai and van Dyk (2005a).
+}
 
 \usage{
 mnp(formula, data = parent.frame(), choiceX = NULL, cXnames = NULL,
@@ -214,9 +215,8 @@ predict(res2, newdata = japan[10,], type = "prob")
 \author{
   Kosuke Imai, Department of Politics, Princeton University
   \email{kimai at Princeton.Edu}, \url{http://imai.princeton.edu};
-  Jordan R. Vance, Princeton University; David A. van Dyk, Department of
-  Statistics, University of California, Irvine \email{dvd at uci.edu},
-  \url{http://www.ics.uci.edu/~dvd}.  
+  David A. van Dyk, Department of Statistics, University of California,
+Irvine \email{dvd at uci.edu}, \url{http://www.ics.uci.edu/~dvd}.  
 }
 
 \seealso{\code{coef.mnp}, \code{cov.mnp}, \code{predict.mnp},
diff --git a/src/vector.c b/src/vector.c
index 02d7949..6f8b1a1 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -1,10 +1,3 @@
-/******************************************************************
-  This file is a part of MNP: R Package for Estimating the 
-  Multinomial Probit Models by Kosuke Imai, Jordan R. Vance, and 
-  David A. van Dyk.
-  Copyright: GPL version 2 or later.
-*******************************************************************/
-
 #include <stdlib.h>
 #include <assert.h>
 #include <stdio.h>
@@ -13,68 +6,102 @@
 
 int* intArray(int num) {
   int *iArray = (int *)malloc(num * sizeof(int));
-  if (iArray)
-    return iArray;
-  else 
+  if (!iArray)
     error("Out of memory error in intArray\n");
+  return iArray;
+}
+
+void PintArray(int *ivector, int length) {
+  int i;
+  for (i = 0; i < length; i++)
+    Rprintf("%5d\n", ivector[i]);
 }
 
 int** intMatrix(int row, int col) {
   int i;
   int **iMatrix = (int **)malloc(row * sizeof(int *));
-  if (iMatrix) {
-    for (i = 0; i < row; i++) {
-      iMatrix[i] = (int *)malloc(col *  sizeof(int));
-      if (!iMatrix[i]) 
-	error("Out of memory error in intMatrix\n");
-    }
-    return iMatrix;
-  }
-  else 
+  if (!iMatrix) 
     error("Out of memory error in intMatrix\n");
+  for (i = 0; i < row; i++) {
+    iMatrix[i] = (int *)malloc(col *  sizeof(int));
+    if (!iMatrix[i]) 
+      error("Out of memory error in intMatrix\n");
+  }
+  return iMatrix;
 }
 
+void PintMatrix(int **imatrix, int row, int col) {
+  int i, j;
+  for (i = 0; i < row; i++) {
+    for (j = 0; j < col; j++)
+      Rprintf("%5d", imatrix[i][j]);
+    Rprintf("\n");
+  }
+}
+
+
 double* doubleArray(int num) {
   double *dArray = (double *)malloc(num * sizeof(double));
-  if (dArray)
-    return dArray;
-  else
+  if (!dArray)
     error("Out of memory error in doubleArray\n");
+  return dArray;
+}
+
+void PdoubleArray(double *dvector, int length) {
+  int i;
+  for (i = 0; i < length; i++)
+    Rprintf("%14g\n", dvector[i]);
 }
 
 double** doubleMatrix(int row, int col) {
   int i;
   double **dMatrix = (double **)malloc((size_t)(row * sizeof(double *)));
-  if (dMatrix) {
-    for (i = 0; i < row; i++) {
-      dMatrix[i] = (double *)malloc((size_t)(col * sizeof(double)));
-      if (!dMatrix[i])
-	error("Out of memory error in doubleMatrix\n");
-    }
-    return dMatrix;
-  }
-  else
+  if (!dMatrix) 
     error("Out of memory error in doubleMatrix\n");
+  for (i = 0; i < row; i++) {
+    dMatrix[i] = (double *)malloc((size_t)(col * sizeof(double)));
+    if (!dMatrix[i])
+      error("Out of memory error in doubleMatrix\n");
+  }
+  return dMatrix;
+}
+
+void PdoubleMatrix(double **dmatrix, int row, int col) {
+  int i, j;
+  for (i = 0; i < row; i++) {
+    for (j = 0; j < col; j++)
+      Rprintf("%14g", dmatrix[i][j]);
+    Rprintf("\n");
+  }
 }
 
 double*** doubleMatrix3D(int x, int y, int z) {
   int i;
   double ***dM3 = (double ***)malloc(x * sizeof(double **));
-  if (dM3) {
-    for (i = 0; i < x; i++) 
-      dM3[i] = doubleMatrix(y, z);
-    return dM3;
-  }
-  else 
+  if (!dM3) 
     error("Out of memory error in doubleMatrix3D\n");
+  for (i = 0; i < x; i++) 
+    dM3[i] = doubleMatrix(y, z);
+  return dM3;
+}
+
+void PdoubleMatrix3D(double ***dmatrix3D, int x, int y, int z) {
+  int i, j, k;
+  for (i = 0; i < x; i++) {
+    Rprintf("Fist dimension = %5d\n", i);
+    for (j = 0; j < y; j++) {
+      for (k = 0; k < z; k++)
+	Rprintf("%14g", dmatrix3D[i][j][k]);
+      Rprintf("\n");
+    }
+  }
 }
 
 long* longArray(int num) {
   long *lArray = (long *)malloc(num * sizeof(long));
-  if (lArray)
-    return lArray;
-  else 
+  if (!lArray)
     error("Out of memory error in longArray\n");
+  return lArray;
 }
 
 void FreeMatrix(double **Matrix, int row) {
diff --git a/src/vector.h b/src/vector.h
index 220485c..5c99ddc 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -1,19 +1,18 @@
-/******************************************************************
-  This file is a part of MNP: R Package for Estimating the 
-  Multinomial Probit Models by Kosuke Imai, Jordan R. Vance, and 
-  David A. van Dyk.
-  Copyright: GPL version 2 or later.
-*******************************************************************/
-
 #include <stdlib.h>
 #include <assert.h>
 
 int *intArray(int num);
+void PintArray(int *ivector, int length);
 int **intMatrix(int row, int col);
+void PintMatrix(int **imatrix, int row, int col);
 
 double *doubleArray(int num);
+void PdoubleArray(double *dvector, int length);
 double **doubleMatrix(int row, int col);
+void PdoubleMatrix(double **dmatrix, int row, int col);
+
 double ***doubleMatrix3D(int x, int y, int z);
+void PdoubleMatrix3D(double ***dmatrix3D, int x, int y, int z);
 
 long *longArray(int num);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-mnp.git



More information about the debian-science-commits mailing list