{"action":"created","comment":{"url":"https://api.github.com/repos/etmc/tmLQCD/pulls/comments/55029066","id":55029066,"diff_hunk":"@@ -0,0 +1,321 @@\n+/***********************************************************************\n+ * Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Carsten Urbach\n+ *               2010 claude Tadonki\n+ *\n+ * This file is part of tmLQCD.\n+ *\n+ * tmLQCD is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ * \n+ * tmLQCD is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ * \n+ * You should have received a copy of the GNU General Public License\n+ * along with tmLQCD.  If not, see <http://www.gnu.org/licenses/>.\n+ ***********************************************************************/\n+\n+\n+\n+static void _PSWITCH(init_lgcr)(const int _M, const int _V);\n+static void _PSWITCH(free_lgcr)();\n+static _C_TYPE ** _PSWITCH(a)     = NULL; \n+static _C_TYPE *  _PSWITCH(_a)    = NULL;\n+static _F_TYPE *  _PSWITCH(b)     = NULL;\n+static _C_TYPE *  _PSWITCH(c)     = NULL;\n+static _C_TYPE ** _PSWITCH(chi)   = NULL;\n+static _C_TYPE *  _PSWITCH(_chi)  = NULL;\n+static _C_TYPE ** _PSWITCH(xi)    = NULL;\n+static _C_TYPE *  _PSWITCH(_xi)   = NULL;\n+static _C_TYPE *  _PSWITCH(tmp)   = NULL;\n+static _C_TYPE *  _PSWITCH(rho)   = NULL;\n+static int _PSWITCH(lgcr_init)   = 0;\n+\n+\n+int _PSWITCH(gcr4complex)(_C_TYPE * const P, _C_TYPE * const Q, \n+                          const int m, const int max_restarts,\n+                          const double eps_sq, const int rel_prec,\n+                          const int N, const int parallel, \n+                          const int lda, const int precon, _PSWITCH(c_matrix_mult) f) {\n+\n+  int k, l, restart, i, p=0;\n+  double norm_sq, err;\n+  _C_TYPE ctmp;\n+\n+  _PSWITCH(init_lgcr)(m, lda);\n+\n+  norm_sq = _PSWITCH(lsquare_norm)(Q, N, parallel);\n+  if(norm_sq < 1.e-20) {\n+    norm_sq = 1.;\n+  }\n+\n+  for(restart = 0; restart < max_restarts; restart++) {\n+    f(_PSWITCH(tmp), P);\n+    _PSWITCH(ldiff)(_PSWITCH(rho), Q, _PSWITCH(tmp), N);\n+    err = _PSWITCH(lsquare_norm)(_PSWITCH(rho), N, parallel);\n+    if(g_proc_id == g_stdio_proc && g_debug_level > 2){\n+      printf(\"lGCR: %d\\t%g true residue\\n\", p, err); \n+      fflush(stdout);\n+    }\n+    if(((err <= eps_sq) && (rel_prec == 0)) || ((err <= eps_sq * norm_sq) && (rel_prec == 1))) {\n+      if(g_proc_id == 0 && g_debug_level > 2) printf(\"lGCR: %d %e %e %e %e\\n\", p, err, norm_sq, err/norm_sq, eps_sq);\n+      return (p);\n+    }\n+    for(k = 0; k < m ; k++) {\n+      if(precon == 0) {\n+        memcpy(_PSWITCH(xi)[k], _PSWITCH(rho), N*sizeof(_C_TYPE));\n+      }\n+      else {\n+\t_PSWITCH(little_mg_precon)(_PSWITCH(xi)[k], _PSWITCH(rho));\n+      }\n+      f(_PSWITCH(tmp), _PSWITCH(xi)[k]); \n+      /* tmp will become chi[k] */\n+      for(l = 0; l < k; l++) {\n+        _PSWITCH(a)[l][k] = _PSWITCH(lscalar_prod)(_PSWITCH(chi)[l], _PSWITCH(tmp), N, parallel);\n+        _PSWITCH(lassign_diff_mul)(_PSWITCH(tmp), _PSWITCH(chi)[l], _PSWITCH(a)[l][k], N);\n+      }\n+      _PSWITCH(b)[k] = sqrt(_PSWITCH(lsquare_norm)(_PSWITCH(tmp), N, parallel));\n+      _PSWITCH(lmul_r)(_PSWITCH(chi)[k], 1./_PSWITCH(b)[k], _PSWITCH(tmp), N);\n+      _PSWITCH(c)[k] = _PSWITCH(lscalar_prod)(_PSWITCH(chi)[k], _PSWITCH(rho), N, parallel);\n+      _PSWITCH(lassign_diff_mul)(_PSWITCH(rho), _PSWITCH(chi)[k], _PSWITCH(c)[k], N);\n+      err = _PSWITCH(lsquare_norm)(_PSWITCH(rho), N, parallel);\n+      if(g_proc_id == g_stdio_proc && g_debug_level > 2){\n+        printf(\"lGCR: %d\\t%g iterated residue\\n\", p, err); \n+        fflush(stdout);\n+      }\n+      p++;\n+      /* Precision reached? */\n+      if((k == m-1) || ((err <= eps_sq) && (rel_prec == 0)) || ((err <= eps_sq*norm_sq) && (rel_prec == 1))) {\n+        break;\n+      }\n+    }\n+    /* prepare for restart */\n+    _PSWITCH(c)[k] /= _PSWITCH(b)[k];\n+    _PSWITCH(lassign_add_mul)(P, _PSWITCH(xi)[k], _PSWITCH(c)[k], N);\n+    for(l = k-1; l >= 0; --l) {\n+      for(i = l+1; i <= k; ++i) {\n+        ctmp  = _PSWITCH(a)[l][i] * _PSWITCH(c)[i];\n+        _PSWITCH(c)[l] -= ctmp;","path":"solver/gcr4complex_body.c","position":101,"original_position":101,"commit_id":"83dc9a0a288ac99d0eefeb8e2d3cbbb7bdd288d1","original_commit_id":"83dc9a0a288ac99d0eefeb8e2d3cbbb7bdd288d1","user":{"login":"urbach","id":1326199,"avatar_url":"https://avatars.githubusercontent.com/u/1326199?v=3","gravatar_id":"","url":"https://api.github.com/users/urbach","html_url":"https://github.com/urbach","followers_url":"https://api.github.com/users/urbach/followers","following_url":"https://api.github.com/users/urbach/following{/other_user}","gists_url":"https://api.github.com/users/urbach/gists{/gist_id}","starred_url":"https://api.github.com/users/urbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbach/subscriptions","organizations_url":"https://api.github.com/users/urbach/orgs","repos_url":"https://api.github.com/users/urbach/repos","events_url":"https://api.github.com/users/urbach/events{/privacy}","received_events_url":"https://api.github.com/users/urbach/received_events","type":"User","site_admin":false},"body":"okay, here we want to solve to a loose precision only anyhow, 10^-2 or so...","created_at":"2016-03-04T13:27:49Z","updated_at":"2016-03-04T13:27:49Z","html_url":"https://github.com/etmc/tmLQCD/pull/306#discussion_r55029066","pull_request_url":"https://api.github.com/repos/etmc/tmLQCD/pulls/306","_links":{"self":{"href":"https://api.github.com/repos/etmc/tmLQCD/pulls/comments/55029066"},"html":{"href":"https://github.com/etmc/tmLQCD/pull/306#discussion_r55029066"},"pull_request":{"href":"https://api.github.com/repos/etmc/tmLQCD/pulls/306"}}},"pull_request":{"url":"https://api.github.com/repos/etmc/tmLQCD/pulls/306","id":56151087,"html_url":"https://github.com/etmc/tmLQCD/pull/306","diff_url":"https://github.com/etmc/tmLQCD/pull/306.diff","patch_url":"https://github.com/etmc/tmLQCD/pull/306.patch","issue_url":"https://api.github.com/repos/etmc/tmLQCD/issues/306","number":306,"state":"open","locked":false,"title":"Merge deflation","user":{"login":"urbach","id":1326199,"avatar_url":"https://avatars.githubusercontent.com/u/1326199?v=3","gravatar_id":"","url":"https://api.github.com/users/urbach","html_url":"https://github.com/urbach","followers_url":"https://api.github.com/users/urbach/followers","following_url":"https://api.github.com/users/urbach/following{/other_user}","gists_url":"https://api.github.com/users/urbach/gists{/gist_id}","starred_url":"https://api.github.com/users/urbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbach/subscriptions","organizations_url":"https://api.github.com/users/urbach/orgs","repos_url":"https://api.github.com/users/urbach/repos","events_url":"https://api.github.com/users/urbach/events{/privacy}","received_events_url":"https://api.github.com/users/urbach/received_events","type":"User","site_admin":false},"body":"okay, this is a long commit :( \r\n\r\nIt provides a running inexact deflation solver for TM and TM+CLOVER (single flavour). It is tested serially and MPI parallel, but not yet with OpenMP! \r\n\r\nThis commit also includes a non-even/odd clover operator implementation.\r\n\r\nA point for discussion is where to call the deflation subspace generation and sw_invert etc. I don't think that invert.c is the best place for this. ","created_at":"2016-01-15T10:11:10Z","updated_at":"2016-03-04T13:27:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d2cf79c0b976d7ceeb7de4599e5d0fc9e62f520","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/etmc/tmLQCD/pulls/306/commits","review_comments_url":"https://api.github.com/repos/etmc/tmLQCD/pulls/306/comments","review_comment_url":"https://api.github.com/repos/etmc/tmLQCD/pulls/comments{/number}","comments_url":"https://api.github.com/repos/etmc/tmLQCD/issues/306/comments","statuses_url":"https://api.github.com/repos/etmc/tmLQCD/statuses/83dc9a0a288ac99d0eefeb8e2d3cbbb7bdd288d1","head":{"label":"urbach:Merge_Deflation","ref":"Merge_Deflation","sha":"83dc9a0a288ac99d0eefeb8e2d3cbbb7bdd288d1","user":{"login":"urbach","id":1326199,"avatar_url":"https://avatars.githubusercontent.com/u/1326199?v=3","gravatar_id":"","url":"https://api.github.com/users/urbach","html_url":"https://github.com/urbach","followers_url":"https://api.github.com/users/urbach/followers","following_url":"https://api.github.com/users/urbach/following{/other_user}","gists_url":"https://api.github.com/users/urbach/gists{/gist_id}","starred_url":"https://api.github.com/users/urbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbach/subscriptions","organizations_url":"https://api.github.com/users/urbach/orgs","repos_url":"https://api.github.com/users/urbach/repos","events_url":"https://api.github.com/users/urbach/events{/privacy}","received_events_url":"https://api.github.com/users/urbach/received_events","type":"User","site_admin":false},"repo":{"id":3170779,"name":"tmLQCD","full_name":"urbach/tmLQCD","owner":{"login":"urbach","id":1326199,"avatar_url":"https://avatars.githubusercontent.com/u/1326199?v=3","gravatar_id":"","url":"https://api.github.com/users/urbach","html_url":"https://github.com/urbach","followers_url":"https://api.github.com/users/urbach/followers","following_url":"https://api.github.com/users/urbach/following{/other_user}","gists_url":"https://api.github.com/users/urbach/gists{/gist_id}","starred_url":"https://api.github.com/users/urbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbach/subscriptions","organizations_url":"https://api.github.com/users/urbach/orgs","repos_url":"https://api.github.com/users/urbach/repos","events_url":"https://api.github.com/users/urbach/events{/privacy}","received_events_url":"https://api.github.com/users/urbach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/urbach/tmLQCD","description":"tmLQCD is a freely available software suite providing a set of tools to be used in lattice QCD simulations. This is mainly a HMC (including PHMC and RHMC) implementation for Wilson, Wilson Clover and Wilson twisted mass fermions and inverter for different versions of the Dirac operator.  The code is fully parallelised and ships with optimisations for various modern architectures, such as commodity PC clusters and the Blue Gene family. ","fork":true,"url":"https://api.github.com/repos/urbach/tmLQCD","forks_url":"https://api.github.com/repos/urbach/tmLQCD/forks","keys_url":"https://api.github.com/repos/urbach/tmLQCD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urbach/tmLQCD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urbach/tmLQCD/teams","hooks_url":"https://api.github.com/repos/urbach/tmLQCD/hooks","issue_events_url":"https://api.github.com/repos/urbach/tmLQCD/issues/events{/number}","events_url":"https://api.github.com/repos/urbach/tmLQCD/events","assignees_url":"https://api.github.com/repos/urbach/tmLQCD/assignees{/user}","branches_url":"https://api.github.com/repos/urbach/tmLQCD/branches{/branch}","tags_url":"https://api.github.com/repos/urbach/tmLQCD/tags","blobs_url":"https://api.github.com/repos/urbach/tmLQCD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urbach/tmLQCD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urbach/tmLQCD/git/refs{/sha}","trees_url":"https://api.github.com/repos/urbach/tmLQCD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urbach/tmLQCD/statuses/{sha}","languages_url":"https://api.github.com/repos/urbach/tmLQCD/languages","stargazers_url":"https://api.github.com/repos/urbach/tmLQCD/stargazers","contributors_url":"https://api.github.com/repos/urbach/tmLQCD/contributors","subscribers_url":"https://api.github.com/repos/urbach/tmLQCD/subscribers","subscription_url":"https://api.github.com/repos/urbach/tmLQCD/subscription","commits_url":"https://api.github.com/repos/urbach/tmLQCD/commits{/sha}","git_commits_url":"https://api.github.com/repos/urbach/tmLQCD/git/commits{/sha}","comments_url":"https://api.github.com/repos/urbach/tmLQCD/comments{/number}","issue_comment_url":"https://api.github.com/repos/urbach/tmLQCD/issues/comments{/number}","contents_url":"https://api.github.com/repos/urbach/tmLQCD/contents/{+path}","compare_url":"https://api.github.com/repos/urbach/tmLQCD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urbach/tmLQCD/merges","archive_url":"https://api.github.com/repos/urbach/tmLQCD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urbach/tmLQCD/downloads","issues_url":"https://api.github.com/repos/urbach/tmLQCD/issues{/number}","pulls_url":"https://api.github.com/repos/urbach/tmLQCD/pulls{/number}","milestones_url":"https://api.github.com/repos/urbach/tmLQCD/milestones{/number}","notifications_url":"https://api.github.com/repos/urbach/tmLQCD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urbach/tmLQCD/labels{/name}","releases_url":"https://api.github.com/repos/urbach/tmLQCD/releases{/id}","deployments_url":"https://api.github.com/repos/urbach/tmLQCD/deployments","created_at":"2012-01-13T13:00:18Z","updated_at":"2015-03-10T07:16:23Z","pushed_at":"2016-03-04T07:16:13Z","git_url":"git://github.com/urbach/tmLQCD.git","ssh_url":"git@github.com:urbach/tmLQCD.git","clone_url":"https://github.com/urbach/tmLQCD.git","svn_url":"https://github.com/urbach/tmLQCD","homepage":"http://www.itkp.uni-bonn.de/~urbach/software.html","size":25056,"stargazers_count":5,"watchers_count":5,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":5,"default_branch":"master"}},"base":{"label":"etmc:master","ref":"master","sha":"07cbe0c8caebab288268dd0792077ff78bfbbdf3","user":{"login":"etmc","id":1327227,"avatar_url":"https://avatars.githubusercontent.com/u/1327227?v=3","gravatar_id":"","url":"https://api.github.com/users/etmc","html_url":"https://github.com/etmc","followers_url":"https://api.github.com/users/etmc/followers","following_url":"https://api.github.com/users/etmc/following{/other_user}","gists_url":"https://api.github.com/users/etmc/gists{/gist_id}","starred_url":"https://api.github.com/users/etmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etmc/subscriptions","organizations_url":"https://api.github.com/users/etmc/orgs","repos_url":"https://api.github.com/users/etmc/repos","events_url":"https://api.github.com/users/etmc/events{/privacy}","received_events_url":"https://api.github.com/users/etmc/received_events","type":"Organization","site_admin":false},"repo":{"id":3169640,"name":"tmLQCD","full_name":"etmc/tmLQCD","owner":{"login":"etmc","id":1327227,"avatar_url":"https://avatars.githubusercontent.com/u/1327227?v=3","gravatar_id":"","url":"https://api.github.com/users/etmc","html_url":"https://github.com/etmc","followers_url":"https://api.github.com/users/etmc/followers","following_url":"https://api.github.com/users/etmc/following{/other_user}","gists_url":"https://api.github.com/users/etmc/gists{/gist_id}","starred_url":"https://api.github.com/users/etmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etmc/subscriptions","organizations_url":"https://api.github.com/users/etmc/orgs","repos_url":"https://api.github.com/users/etmc/repos","events_url":"https://api.github.com/users/etmc/events{/privacy}","received_events_url":"https://api.github.com/users/etmc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/etmc/tmLQCD","description":"tmLQCD is a freely available software suite providing a set of tools to be used in lattice QCD simulations. This is mainly a HMC implementation (including PHMC and RHMC) for Wilson, Wilson Clover and Wilson twisted mass fermions and inverter for different versions of the Dirac operator.  The code is fully parallelised and ships with optimisations for various modern architectures, such as commodity PC clusters and the Blue Gene family. ","fork":false,"url":"https://api.github.com/repos/etmc/tmLQCD","forks_url":"https://api.github.com/repos/etmc/tmLQCD/forks","keys_url":"https://api.github.com/repos/etmc/tmLQCD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/etmc/tmLQCD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/etmc/tmLQCD/teams","hooks_url":"https://api.github.com/repos/etmc/tmLQCD/hooks","issue_events_url":"https://api.github.com/repos/etmc/tmLQCD/issues/events{/number}","events_url":"https://api.github.com/repos/etmc/tmLQCD/events","assignees_url":"https://api.github.com/repos/etmc/tmLQCD/assignees{/user}","branches_url":"https://api.github.com/repos/etmc/tmLQCD/branches{/branch}","tags_url":"https://api.github.com/repos/etmc/tmLQCD/tags","blobs_url":"https://api.github.com/repos/etmc/tmLQCD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/etmc/tmLQCD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/etmc/tmLQCD/git/refs{/sha}","trees_url":"https://api.github.com/repos/etmc/tmLQCD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/etmc/tmLQCD/statuses/{sha}","languages_url":"https://api.github.com/repos/etmc/tmLQCD/languages","stargazers_url":"https://api.github.com/repos/etmc/tmLQCD/stargazers","contributors_url":"https://api.github.com/repos/etmc/tmLQCD/contributors","subscribers_url":"https://api.github.com/repos/etmc/tmLQCD/subscribers","subscription_url":"https://api.github.com/repos/etmc/tmLQCD/subscription","commits_url":"https://api.github.com/repos/etmc/tmLQCD/commits{/sha}","git_commits_url":"https://api.github.com/repos/etmc/tmLQCD/git/commits{/sha}","comments_url":"https://api.github.com/repos/etmc/tmLQCD/comments{/number}","issue_comment_url":"https://api.github.com/repos/etmc/tmLQCD/issues/comments{/number}","contents_url":"https://api.github.com/repos/etmc/tmLQCD/contents/{+path}","compare_url":"https://api.github.com/repos/etmc/tmLQCD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/etmc/tmLQCD/merges","archive_url":"https://api.github.com/repos/etmc/tmLQCD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/etmc/tmLQCD/downloads","issues_url":"https://api.github.com/repos/etmc/tmLQCD/issues{/number}","pulls_url":"https://api.github.com/repos/etmc/tmLQCD/pulls{/number}","milestones_url":"https://api.github.com/repos/etmc/tmLQCD/milestones{/number}","notifications_url":"https://api.github.com/repos/etmc/tmLQCD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/etmc/tmLQCD/labels{/name}","releases_url":"https://api.github.com/repos/etmc/tmLQCD/releases{/id}","deployments_url":"https://api.github.com/repos/etmc/tmLQCD/deployments","created_at":"2012-01-13T09:15:03Z","updated_at":"2015-09-09T06:28:30Z","pushed_at":"2016-03-04T07:16:13Z","git_url":"git://github.com/etmc/tmLQCD.git","ssh_url":"git@github.com:etmc/tmLQCD.git","clone_url":"https://github.com/etmc/tmLQCD.git","svn_url":"https://github.com/etmc/tmLQCD","homepage":"http://www.itkp.uni-bonn.de/~urbach/software.html","size":25175,"stargazers_count":21,"watchers_count":21,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":90,"forks":35,"open_issues":90,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/etmc/tmLQCD/pulls/306"},"html":{"href":"https://github.com/etmc/tmLQCD/pull/306"},"issue":{"href":"https://api.github.com/repos/etmc/tmLQCD/issues/306"},"comments":{"href":"https://api.github.com/repos/etmc/tmLQCD/issues/306/comments"},"review_comments":{"href":"https://api.github.com/repos/etmc/tmLQCD/pulls/306/comments"},"review_comment":{"href":"https://api.github.com/repos/etmc/tmLQCD/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/etmc/tmLQCD/pulls/306/commits"},"statuses":{"href":"https://api.github.com/repos/etmc/tmLQCD/statuses/83dc9a0a288ac99d0eefeb8e2d3cbbb7bdd288d1"}}}}