From 479eedef2de5e5513f6c583b01e17b2fcde81c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alois=20Schl=C3=B6gl?= Date: Sun, 20 Sep 2015 23:13:14 +0200 Subject: [PATCH] avoid storing extra (Bernoulli) matrix - but do the Bernoulli conversion only when writing the matrix --- run_secorder.cpp | 2 +- secorder_rec_1p.cpp | 25 +------------------------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/run_secorder.cpp b/run_secorder.cpp index 9da3dd3..02bde28 100644 --- a/run_secorder.cpp +++ b/run_secorder.cpp @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) { for(int i=0; i1.0); } fprintf(fhnd,"\n"); } diff --git a/secorder_rec_1p.cpp b/secorder_rec_1p.cpp index f18aaa3..0a921ce 100644 --- a/secorder_rec_1p.cpp +++ b/secorder_rec_1p.cpp @@ -207,30 +207,7 @@ gsl_matrix* secorder_rec_1p(int N_nodes, double p, } - //////////////////////////////////////////////////////////// - // Step 5: Calculate Bernoulli matrix - // Simply make the Bernoulli variable be 1 - // if the Gaussian variable is greater than 1 - //////////////////////////////////////////////////////////// - - cout << "Generating Bernoulli matrix..."; - cout.flush(); - // calculate bernoulli matrix - gsl_matrix *W_ber = gsl_matrix_alloc(N_nodes, N_nodes); - for(int i=0; i1.0); - } - } - - // free Gaussian matrix - gsl_matrix_free(W_gaus); - - cout << "done\n"; - cout.flush(); - - // return Bernoulli matrix - return W_ber; + return W_gaus; } -- GitLab