void C_LinStatExpCovMPinv(SEXP linexpcov, double tol) { int pq, pqn; /* correct working dimension */ pq = get_dimension(linexpcov); /* reduce dimension to non-zero variance part */ C_linexpcovReduce(linexpcov); /* reduced dimension */ pqn = get_dimension(linexpcov); INTEGER(GET_SLOT(GET_SLOT(linexpcov, PL2_svdmemSym), PL2_pSym))[0] = pqn; /* compute MPinv in reduced dimension */ /* GET_SLOT is assumed NOT to return a fresh object so we don't PROTECT here */ C_MPinv(PROTECT(GET_SLOT(linexpcov, PL2_covarianceSym)), tol, PROTECT(GET_SLOT(linexpcov, PL2_svdmemSym)), linexpcov); UNPROTECT(2); /* make sure to reset svdmem to original dimension; the dimension of linexpcov is reset in C_TestStatistic */ INTEGER(GET_SLOT(GET_SLOT(linexpcov, PL2_svdmemSym), PL2_pSym))[0] = pq; }
void C_LinStatExpCovMPinv(SEXP linexpcov, double tol) { int pq, pqn; /* correct working dimension */ pq = get_dimension(linexpcov); /* reduce dimension to non-zero variance part */ C_linexpcovReduce(linexpcov); /* reduced dimension */ pqn = get_dimension(linexpcov); INTEGER(GET_SLOT(GET_SLOT(linexpcov, PL2_svdmemSym), PL2_pSym))[0] = pqn; /* compute MPinv in reduced dimension */ C_MPinv(GET_SLOT(linexpcov, PL2_covarianceSym), tol, GET_SLOT(linexpcov, PL2_svdmemSym), linexpcov); /* make sure to reset svdmem to original dimension; the dimension of linexpcov is reset in C_TestStatistic */ INTEGER(GET_SLOT(GET_SLOT(linexpcov, PL2_svdmemSym), PL2_pSym))[0] = pq; }