[Lme4-commits] r1558 - pkg/lme4Eigen/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 2 19:11:04 CET 2012


Author: dmbates
Date: 2012-02-02 19:11:04 +0100 (Thu, 02 Feb 2012)
New Revision: 1558

Removed:
   pkg/lme4Eigen/src/reTrms.cpp
   pkg/lme4Eigen/src/reTrms.h
Log:
Better to do these operations in R


Deleted: pkg/lme4Eigen/src/reTrms.cpp
===================================================================
--- pkg/lme4Eigen/src/reTrms.cpp	2012-02-01 23:09:57 UTC (rev 1557)
+++ pkg/lme4Eigen/src/reTrms.cpp	2012-02-02 18:11:04 UTC (rev 1558)
@@ -1,61 +0,0 @@
-//
-// reTrms.cpp: random-effects terms objects
-//
-// Copyright (C)      2012 Douglas Bates, Martin Maechler and Ben Bolker
-//
-// This file is part of lme4.
-
-#include "predModule.h"
-
-namespace lme4Eigen {
-    reTrms::reTrms(SEXP cnms, SEXP flist)
-	: d_cnms(cnms),
-	  d_flist(flist),
-	  d_assign(d_flist.attr("assign")) {
-    }
-
-    Eigen::VectorXi reTrms::ncols() const {
-	int nt = d_cnms.size();
-	Eigen::VectorXi ans(nt);
-	int *ap = ans.data();
-	for (int i = 0; i < nt; i++) {
-	    Rcpp::CharacterVector nmi = d_cnms(i);
-	    ap[i] = nmi.size();
-	}
-	return ans;
-    }
-
-    Eigen::VectorXi reTrms::nctot() const {
-	Eigen::VectorXi ans(d_flist.size()), nc = ncols();
-	const int *asg = d_assign.begin(), *ncp = nc.data(), nnc(nc.size());
-	int *ansp = ans.data();
-	ans.setZero();
-	for (int i = 0; i < nnc; i++) ansp[asg[i] - 1] += ncp[i];
-	return ans;
-    }
-
-    Eigen::VectorXi reTrms::nlevs() const {
-	int nfac = d_flist.size();
-	Eigen::VectorXi ans(nfac);
-	int *ap = ans.data();
-	for (int i = 0; i < nfac; i++) {
-	    Rcpp::IntegerVector   fi = d_flist(i);
-	    Rcpp::CharacterVector ll = fi.attr("levels");
-	    ap[i] = ll.size();
-	}
-	return ans;
-    }
-
-    Eigen::VectorXi reTrms::offsets() const {
-	const int *asgn = d_assign.begin(), ntrm(d_cnms.size());
-	Eigen::VectorXi ans(ntrm), nc = ncols(), nl = nlevs();
-	int *ansp = ans.data(), offset = 0;
-	const int *ncp = nc.data(),  *nlp = nl.data();
-	for (int i = 0; i < ntrm; ++i) {
-	    ansp[i] = offset;
-	    offset += ncp[i] * nlp[asgn[i] - 1];
-	}
-	return ans;
-    }
-
-}

Deleted: pkg/lme4Eigen/src/reTrms.h
===================================================================
--- pkg/lme4Eigen/src/reTrms.h	2012-02-01 23:09:57 UTC (rev 1557)
+++ pkg/lme4Eigen/src/reTrms.h	2012-02-02 18:11:04 UTC (rev 1558)
@@ -1,34 +0,0 @@
-// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
-//
-// reTrms.h: random-effects terms objects
-//
-// Copyright (C)       2012 Douglas Bates, Martin Maechler and Ben Bolker
-//
-// This file is part of lme4.
-
-#ifndef LME4_RETRMS_H
-#define LME4_RETRMS_H
-
-#include <RcppEigen.h>
-
-namespace lme4Eigen {
-    class reTrms {
-    protected:
-	Rcpp::List            d_cnms;
-	Rcpp::List           d_flist;
-	Rcpp::IntegerVector d_assign;
-    public:
-	reTrms(SEXP, SEXP);
-
-	const Rcpp::List&          flist() const {return d_flist;}
-	const Rcpp::List&           cnms() const {return d_cnms;}
-
-	Eigen::VectorXi            nctot() const;
-	Eigen::VectorXi            ncols() const;
-	Eigen::VectorXi            nlevs() const;
-	Eigen::VectorXi          offsets() const;
-	Eigen::VectorXi            terms(const int&) const;
-    };
-}
-
-#endif // LME4_RETRMS_H



More information about the Lme4-commits mailing list