{"action":"created","issue":{"url":"https://api.github.com/repos/FertigLab/CoGAPS/issues/1","repository_url":"https://api.github.com/repos/FertigLab/CoGAPS","labels_url":"https://api.github.com/repos/FertigLab/CoGAPS/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/FertigLab/CoGAPS/issues/1/comments","events_url":"https://api.github.com/repos/FertigLab/CoGAPS/issues/1/events","html_url":"https://github.com/FertigLab/CoGAPS/issues/1","id":277854306,"number":1,"title":"using randgen() to generate random numbers is ineffcient","user":{"login":"sherman5","id":8828115,"avatar_url":"https://avatars0.githubusercontent.com/u/8828115?v=4","gravatar_id":"","url":"https://api.github.com/users/sherman5","html_url":"https://github.com/sherman5","followers_url":"https://api.github.com/users/sherman5/followers","following_url":"https://api.github.com/users/sherman5/following{/other_user}","gists_url":"https://api.github.com/users/sherman5/gists{/gist_id}","starred_url":"https://api.github.com/users/sherman5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sherman5/subscriptions","organizations_url":"https://api.github.com/users/sherman5/orgs","repos_url":"https://api.github.com/users/sherman5/repos","events_url":"https://api.github.com/users/sherman5/events{/privacy}","received_events_url":"https://api.github.com/users/sherman5/received_events","type":"User","site_admin":false},"labels":[{"id":764738746,"url":"https://api.github.com/repos/FertigLab/CoGAPS/labels/LOW%20PRIORITY","name":"LOW PRIORITY","color":"fef2c0","default":false},{"id":764734178,"url":"https://api.github.com/repos/FertigLab/CoGAPS/labels/performance","name":"performance","color":"c2e0c6","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/FertigLab/CoGAPS/milestones/1","html_url":"https://github.com/FertigLab/CoGAPS/milestone/1","labels_url":"https://api.github.com/repos/FertigLab/CoGAPS/milestones/1/labels","id":2947261,"number":1,"title":"Bioconductor 3.7 Release","description":"","creator":{"login":"sherman5","id":8828115,"avatar_url":"https://avatars0.githubusercontent.com/u/8828115?v=4","gravatar_id":"","url":"https://api.github.com/users/sherman5","html_url":"https://github.com/sherman5","followers_url":"https://api.github.com/users/sherman5/followers","following_url":"https://api.github.com/users/sherman5/following{/other_user}","gists_url":"https://api.github.com/users/sherman5/gists{/gist_id}","starred_url":"https://api.github.com/users/sherman5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sherman5/subscriptions","organizations_url":"https://api.github.com/users/sherman5/orgs","repos_url":"https://api.github.com/users/sherman5/repos","events_url":"https://api.github.com/users/sherman5/events{/privacy}","received_events_url":"https://api.github.com/users/sherman5/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":2,"state":"open","created_at":"2017-11-29T17:50:50Z","updated_at":"2017-11-29T22:11:56Z","due_on":"2018-03-30T07:00:00Z","closed_at":null},"comments":2,"created_at":"2017-11-29T18:09:59Z","updated_at":"2017-11-30T00:14:42Z","closed_at":null,"author_association":"OWNER","body":"Any time a random number is generated by calling `randgen`, the function has to go through a switch statement to determine which distribution it should generate the number from. It would be more efficient to have a function for each distribution and call those directly. This would also improve readability of the code.\r\n\r\n```\r\ndouble randgen(char rand_type, double para1, double para2) {\r\n    switch (rand_type) {\r\n        case 'U': {\r\n            boost::random::uniform_01<boost::mt19937 &> zeroone(rng);\r\n            return zeroone();\r\n        }\r\n\r\n        case 'N': {\r\n            double mean = para1;\r\n            double std_dev = para2;\r\n            boost::normal_distribution<> nd(mean, std_dev);\r\n            boost::variate_generator<boost::mt19937 &, boost::normal_distribution<> > norm_rnd(rng, nd);\r\n            return norm_rnd();\r\n        }\r\n\r\n        case 'P': {\r\n            double lambda = (para1 == 0 ? para2 : para1);\r\n            boost::poisson_distribution<> pd(lambda);\r\n            boost::variate_generator<boost::mt19937 &, boost::poisson_distribution<> > poisson_rnd(rng, pd);\r\n            return poisson_rnd();\r\n        }\r\n\r\n        case 'E': {\r\n            double lambda = (para1 == 0 ? para2 : para1);\r\n            boost::exponential_distribution<> expd(lambda);\r\n            boost::variate_generator<boost::mt19937 &, boost::exponential_distribution<> > exp_rnd(rng, expd);\r\n            return exp_rnd();\r\n        }\r\n\r\n        default:\r\n            return -9999.0;\r\n    }\r\n\r\n    // EJF -- return dummy value to avoid warning\r\n    return -9999.0;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/FertigLab/CoGAPS/issues/comments/348040362","html_url":"https://github.com/FertigLab/CoGAPS/issues/1#issuecomment-348040362","issue_url":"https://api.github.com/repos/FertigLab/CoGAPS/issues/1","id":348040362,"user":{"login":"sherman5","id":8828115,"avatar_url":"https://avatars0.githubusercontent.com/u/8828115?v=4","gravatar_id":"","url":"https://api.github.com/users/sherman5","html_url":"https://github.com/sherman5","followers_url":"https://api.github.com/users/sherman5/followers","following_url":"https://api.github.com/users/sherman5/following{/other_user}","gists_url":"https://api.github.com/users/sherman5/gists{/gist_id}","starred_url":"https://api.github.com/users/sherman5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sherman5/subscriptions","organizations_url":"https://api.github.com/users/sherman5/orgs","repos_url":"https://api.github.com/users/sherman5/repos","events_url":"https://api.github.com/users/sherman5/events{/privacy}","received_events_url":"https://api.github.com/users/sherman5/received_events","type":"User","site_admin":false},"created_at":"2017-11-30T00:14:42Z","updated_at":"2017-11-30T00:14:42Z","author_association":"OWNER","body":"```\r\nnIter <- 3000\r\nprint(runCogapsBenchmark(\r\n    D=SimpSim.D,\r\n    S=SimpSim.S,\r\n    nEquil=nIter,\r\n    nSample=nIter,\r\n    nFactor=7,\r\n    seed=12345,\r\n    reps=20\r\n))\r\n```\r\nRan on old randgen implementation\r\n\r\n```\r\n      min       lq     mean   median       uq      max neval\r\n 3.876871 3.894446 3.916033 3.915822 3.925128 4.019523    20\r\n\r\n```\r\n\r\nRan with randgen replaced by Random namespace\r\n\r\n```\r\n```\r\n\r\nRan with mt11213b generator\r\n\r\n```\r\n      min       lq   mean   median       uq      max neval\r\n 3.848418 3.887616 3.9042 3.902471 3.912678 4.087263    20\r\n\r\n```"}}
{"actor":{"display_login":"sherman5"}}