aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Carbonetto2017-06-08 06:37:23 -0500
committerPeter Carbonetto2017-06-08 06:37:23 -0500
commit898770748aa87ad89a5ca10282141fae7f4cbbd5 (patch)
tree576a896936329ab29d09ea2da860ebefee420560
parent93a7a2adb03f61e80badf6a5004fa4850dbb7d48 (diff)
downloadpangemma-898770748aa87ad89a5ca10282141fae7f4cbbd5.tar.gz
Removed FORCE_FLOAT from vc.h, logistic.h.
-rw-r--r--src/logistic.h52
-rw-r--r--src/vc.h95
2 files changed, 85 insertions, 62 deletions
diff --git a/src/logistic.h b/src/logistic.h
index e951935..7f9e133 100644
--- a/src/logistic.h
+++ b/src/logistic.h
@@ -1,4 +1,4 @@
-#ifndef LOGISTIC_H_ /* Include guard */
+#ifndef LOGISTIC_H_
#define LOGISTIC_H_
// Mixed interface.
@@ -29,19 +29,21 @@ double fLogit_mixed(gsl_vector *beta,
double lambdaL1,
double lambdaL2);
-
// Categorical-only interface.
-void logistic_cat_pred(gsl_vector *beta, // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc
- gsl_matrix_int *X, //Matrix Nobs x K
- gsl_vector_int *nlev, // Vector with number categories
- gsl_vector *yhat); //Vector of prob. predicted by the logistic
+void logistic_cat_pred(gsl_vector *beta, // Vector of parameters
+ // length = 1+Sum_k(C_k-1)+Kc.
+ gsl_matrix_int *X, // Matrix Nobs x K.
+ gsl_vector_int *nlev, // Vector with number categories.
+ gsl_vector *yhat); // Vector of prob. predicted by
+ // the logistic.
-int logistic_cat_fit(gsl_vector *beta, // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc
- gsl_matrix_int *X, //Matrix Nobs x K
- gsl_vector_int *nlev, // Vector with number categories
- gsl_vector *y, //Vector of prob. to predict
- double lambdaL1, // Regularization L1 0.0 if not used
- double lambdaL2); // Regularization L2 0.0 if not used
+int logistic_cat_fit(gsl_vector *beta, // Vector of parameters
+ // length = 1+Sum_k(C_k-1)+Kc.
+ gsl_matrix_int *X, // Matrix Nobs x K .
+ gsl_vector_int *nlev, // Vector with number categories.
+ gsl_vector *y, // Vector of prob. to predict.
+ double lambdaL1, // Regularization L1, 0 if not used
+ double lambdaL2); // Regularization L2, 0 if not used
double fLogit_cat(gsl_vector *beta,
gsl_matrix_int *X,
@@ -50,22 +52,24 @@ double fLogit_cat(gsl_vector *beta,
double lambdaL1,
double lambdaL2);
-/* Continuous only interface */
-void logistic_cont_pred(gsl_vector *beta // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc
- ,gsl_matrix *Xc // continuous covariates Matrix Nobs x Kc
- ,gsl_vector *yhat //Vector of prob. predicted by the logistic
- );
+// Continuous-only interface.
+void logistic_cont_pred(gsl_vector *beta, // Vector of parameters
+ // length = 1 + Sum_k(C_k-1) + Kc.
+ gsl_matrix *Xc, // Continuous cov's matrix Nobs x Kc.
+ gsl_vector *yhat);// Vector of prob. predicted
+ // by the logistic.
-int logistic_cont_fit(gsl_vector *beta // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc
- ,gsl_matrix *Xc // continuous covariates Matrix Nobs x Kc
- ,gsl_vector *y //Vector of prob. to predict
- ,double lambdaL1 // Regularization L1 0.0 if not used
- ,double lambdaL2); // Regularization L2 0.0 if not used
+int logistic_cont_fit(gsl_vector *beta, // Vector of parameters
+ // length = 1+Sum_k(C_k-1)+Kc.
+ gsl_matrix *Xc, // Continuous cov's matrix Nobs x Kc.
+ gsl_vector *y, // Vector of prob. to predict.
+ double lambdaL1, // Regularization L1, 0 if not used.
+ double lambdaL2); // Regularization L2, 0 if not used.
double fLogit_cont(gsl_vector *beta,
- gsl_matrix *Xc, // Continuous covariates matrix Nobs x Kc .
+ gsl_matrix *Xc, // Continuous covariates matrix Nobs x Kc.
gsl_vector *y,
double lambdaL1,
double lambdaL2);
-#endif // LOGISTIC_H_
+#endif
diff --git a/src/vc.h b/src/vc.h
index 3358433..43c6979 100644
--- a/src/vc.h
+++ b/src/vc.h
@@ -1,6 +1,6 @@
/*
- Genome-wide Efficient Mixed Model Association (GEMMA)
- Copyright (C) 2011 Xiang Zhou
+ Genome-wide Efficient Mixed Model Association (GEMMA)
+ Copyright (C) 2011-2017, Xiang Zhou
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
@@ -13,7 +13,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __VC_H__
@@ -21,22 +21,12 @@
#include "gsl/gsl_vector.h"
#include "gsl/gsl_matrix.h"
-
-
-#ifdef FORCE_FLOAT
-#include "param_float.h"
-#include "io_float.h"
-#else
#include "param.h"
#include "io.h"
-#endif
using namespace std;
-
-
-class VC_PARAM
-{
+class VC_PARAM {
public:
const gsl_matrix *K;
@@ -50,14 +40,10 @@ public:
bool noconstrain;
};
-
-
-
-
class VC {
public:
- // IO related parameters
+ // IO-related parameters
size_t a_mode;
string file_cat;
string file_beta;
@@ -89,28 +75,61 @@ public:
double time_UtX;
double time_opt;
- // Main functions
+ // Main functions.
void CopyFromParam (PARAM &cPar);
void CopyToParam (PARAM &cPar);
- void WriteFile_qs (const gsl_vector *s_vec, const gsl_vector *q_vec, const gsl_vector *qvar_vec, const gsl_matrix *S_mat, const gsl_matrix *Svar_mat);
- void CalcVChe (const gsl_matrix *K, const gsl_matrix *W, const gsl_vector *y);
- void CalcVCreml (const bool noconstrain, const gsl_matrix *K, const gsl_matrix *W, const gsl_vector *y);
- void CalcVCacl (const gsl_matrix *K, const gsl_matrix *W, const gsl_vector *y);
+ void WriteFile_qs (const gsl_vector *s_vec, const gsl_vector *q_vec,
+ const gsl_vector *qvar_vec, const gsl_matrix *S_mat,
+ const gsl_matrix *Svar_mat);
+ void CalcVChe (const gsl_matrix *K, const gsl_matrix *W,
+ const gsl_vector *y);
+ void CalcVCreml (const bool noconstrain, const gsl_matrix *K,
+ const gsl_matrix *W, const gsl_vector *y);
+ void CalcVCacl (const gsl_matrix *K, const gsl_matrix *W,
+ const gsl_vector *y);
};
-void CalcVCss(const gsl_matrix *Vq, const gsl_matrix *S_mat, const gsl_matrix *Svar_mat, const gsl_vector *q_vec, const gsl_vector *s_vec, const double df, vector<double> &v_pve, vector<double> &v_se_pve, double &pve_total, double &se_pve_total, vector<double> &v_sigma2, vector<double> &v_se_sigma2, vector<double> &v_enrich, vector<double> &v_se_enrich);
-
-
-bool BimbamXwz (const string &file_geno, const int display_pace, vector<int> &indicator_idv, vector<int> &indicator_snp, const vector<size_t> &vec_cat, const gsl_vector *w, const gsl_vector *z, size_t ns_test, gsl_matrix *XWz);
-bool PlinkXwz (const string &file_bed, const int display_pace, vector<int> &indicator_idv, vector<int> &indicator_snp, const vector<size_t> &vec_cat, const gsl_vector *w, const gsl_vector *z, size_t ns_test, gsl_matrix *XWz);
-bool MFILEXwz (const size_t mfile_mode, const string &file_mfile, const int display_pace, vector<int> &indicator_idv, vector<vector<int> > &mindicator_snp, const vector<size_t> &vec_cat, const gsl_vector *w, const gsl_vector *z, gsl_matrix *XWz);
-
-bool BimbamXtXwz (const string &file_geno, const int display_pace, vector<int> &indicator_idv, vector<int> &indicator_snp, const gsl_matrix *XWz, size_t ns_test, gsl_matrix *XtXWz);
-bool PlinkXtXwz (const string &file_bed, const int display_pace, vector<int> &indicator_idv, vector<int> &indicator_snp, const gsl_matrix *XWz, size_t ns_test, gsl_matrix *XtXWz);
-bool MFILEXtXwz (const size_t mfile_mode, const string &file_mfile, const int display_pace, vector<int> &indicator_idv, vector<vector<int> > &mindicator_snp, const gsl_matrix *XWz, gsl_matrix *XtXWz);
-
-void CalcCIss(const gsl_matrix *Xz, const gsl_matrix *XWz, const gsl_matrix *XtXWz, const gsl_matrix *S_mat, const gsl_matrix *Svar_mat, const gsl_vector *w, const gsl_vector *z, const gsl_vector *s_vec, const vector<size_t> &vec_cat, const vector<double> &v_pve, vector<double> &v_se_pve, double &pve_total, double &se_pve_total, vector<double> &v_sigma2, vector<double> &v_se_sigma2, vector<double> &v_enrich, vector<double> &v_se_enrich);
+void CalcVCss(const gsl_matrix *Vq, const gsl_matrix *S_mat,
+ const gsl_matrix *Svar_mat, const gsl_vector *q_vec,
+ const gsl_vector *s_vec, const double df, vector<double> &v_pve,
+ vector<double> &v_se_pve, double &pve_total,
+ double &se_pve_total, vector<double> &v_sigma2,
+ vector<double> &v_se_sigma2, vector<double> &v_enrich,
+ vector<double> &v_se_enrich);
+
+bool BimbamXwz (const string &file_geno, const int display_pace,
+ vector<int> &indicator_idv, vector<int> &indicator_snp,
+ const vector<size_t> &vec_cat, const gsl_vector *w,
+ const gsl_vector *z, size_t ns_test, gsl_matrix *XWz);
+bool PlinkXwz (const string &file_bed, const int display_pace,
+ vector<int> &indicator_idv, vector<int> &indicator_snp,
+ const vector<size_t> &vec_cat, const gsl_vector *w,
+ const gsl_vector *z, size_t ns_test, gsl_matrix *XWz);
+bool MFILEXwz (const size_t mfile_mode, const string &file_mfile,
+ const int display_pace, vector<int> &indicator_idv,
+ vector<vector<int> > &mindicator_snp,
+ const vector<size_t> &vec_cat, const gsl_vector *w,
+ const gsl_vector *z, gsl_matrix *XWz);
+
+bool BimbamXtXwz (const string &file_geno, const int display_pace,
+ vector<int> &indicator_idv, vector<int> &indicator_snp,
+ const gsl_matrix *XWz, size_t ns_test, gsl_matrix *XtXWz);
+bool PlinkXtXwz (const string &file_bed, const int display_pace,
+ vector<int> &indicator_idv, vector<int> &indicator_snp,
+ const gsl_matrix *XWz, size_t ns_test, gsl_matrix *XtXWz);
+bool MFILEXtXwz (const size_t mfile_mode, const string &file_mfile,
+ const int display_pace, vector<int> &indicator_idv,
+ vector<vector<int> > &mindicator_snp, const gsl_matrix *XWz,
+ gsl_matrix *XtXWz);
+
+void CalcCIss(const gsl_matrix *Xz, const gsl_matrix *XWz,
+ const gsl_matrix *XtXWz, const gsl_matrix *S_mat,
+ const gsl_matrix *Svar_mat, const gsl_vector *w,
+ const gsl_vector *z, const gsl_vector *s_vec,
+ const vector<size_t> &vec_cat, const vector<double> &v_pve,
+ vector<double> &v_se_pve, double &pve_total,
+ double &se_pve_total, vector<double> &v_sigma2,
+ vector<double> &v_se_sigma2, vector<double> &v_enrich,
+ vector<double> &v_se_enrich);
#endif
-
-