{"action":"created","comment":{"url":"https://api.github.com/repos/gonum/lapack/pulls/comments/43190158","id":43190158,"diff_hunk":"@@ -0,0 +1,97 @@\n+package native\n+\n+import (\n+\t\"github.com/gonum/blas\"\n+\t\"github.com/gonum/lapack\"\n+)\n+\n+// Dorgqr generates an m×n matrix Q with orthonormal columns defined by the\n+// product of elementary reflectors as computed by Dgeqrf.\n+//  Q = H(0) * H(2) * ... * H(k-1)\n+// Dorgqr is the blocked version of dorg2r that makes greater use of level-3 BLAS\n+// routines.\n+//\n+// The length of tau must be equal to k, and the length of work must be at least n.\n+// It also must be that 0 <= k <= n and 0 <= n <= m. Work is temporary storage,\n+// and lwork specifies the usable memory length. At minimum, lwork >= n, and the\n+// amount of blocking is limited by the usable length. If lwork == -1, instead of\n+// computing Dorg2r the optimal work length is stored into work[0].\n+//\n+// Dorgqr will panic if the conditions on input values are not met.\n+func (impl Implementation) Dorgqr(m, n, k int, a []float64, lda int, tau, work []float64, lwork int) {\n+\tnb := impl.Ilaenv(1, \"DORGQR\", \" \", m, n, k, -1)\n+\tnb = 2\n+\t// work is treated as an n×nb matrix\n+\tif lwork == -1 {\n+\t\twork[0] = float64(n * nb)\n+\t\treturn\n+\t}\n+\tcheckMatrix(m, n, a, lda)\n+\tif k > n {\n+\t\tpanic(kGTN)\n+\t}\n+\tif n > m {\n+\t\tpanic(mLTN)\n+\t}\n+\tif len(tau) < k {\n+\t\tpanic(badTau)\n+\t}\n+\tif len(work) < lwork {\n+\t\tpanic(shortWork)\n+\t}\n+\tif n == 0 {\n+\t\treturn\n+\t}\n+\tnbmin := 2 // Minimum number of blocks\n+\tvar nx int // Minimum number of rows\n+\tiws := n   // Length of work needed\n+\tvar ldwork int\n+\tif nb > 1 && nb < k {\n+\t\tnx = max(0, impl.Ilaenv(3, \"DORGQR\", \" \", m, n, k, -1))\n+\t\tnx = 2\n+\t\tif nx < k {\n+\t\t\tldwork = nb\n+\t\t\tiws = n * ldwork\n+\t\t\tif lwork < iws {\n+\t\t\t\tnb = lwork / n\n+\t\t\t\tldwork = nb\n+\t\t\t\tnbmin = max(2, impl.Ilaenv(2, \"DORGQR\", \" \", m, n, k, -1))\n+\t\t\t}\n+\t\t}\n+\t}\n+\tvar ki, kk int\n+\tif nb >= nbmin && nb < k && nx < k {\n+\t\t// The first kk columns are handled by the blocked method.\n+\t\t// Note: lapack has nx here, but this means the last nx rows are handled\n+\t\t// serially which could be quite different than nb.\n+\t\tki = ((k - nb - 1) / nb) * nb\n+\t\tkk = min(k, ki+nb)\n+\t\tfor j := kk; j < n; j++ {\n+\t\t\tfor i := 0; i < kk; i++ {\n+\t\t\t\ta[i*lda+j] = 0\n+\t\t\t}\n+\t\t}\n+\t}\n+\tif kk < n {\n+\t\t// Perform the operation on colums kk to the end.\n+\t\timpl.Dorg2r(m-kk, n-kk, k-kk, a[kk*lda+kk:], lda, tau[kk:], work)\n+\t}\n+\tif kk == 0 {\n+\t\treturn\n+\t}\n+\t// Perform the operation on column-blocks\n+\tfor i := ki; i >= 0; i -= nb {\n+\t\tib := min(nb, k-i)\n+\t\tif i+ib < n {\n+\t\t\timpl.Dlarft(lapack.Forward, lapack.ColumnWise, m-i, ib, a[i*lda+i:], lda, tau[i:], work, ldwork)\n+\t\t\timpl.Dlarfb(blas.Left, blas.NoTrans, lapack.Forward, lapack.ColumnWise, m-i, n-i-ib, ib, a[i*lda+i:], lda, work, ldwork, a[i*lda+i+ib:], lda, work[ib:], ldwork)","path":"native/dorgqr.go","position":87,"original_position":87,"commit_id":"84493c285fadd973b4ee579897583f560b8ee173","original_commit_id":"84493c285fadd973b4ee579897583f560b8ee173","user":{"login":"btracey","id":3680859,"avatar_url":"https://avatars.githubusercontent.com/u/3680859?v=3","gravatar_id":"","url":"https://api.github.com/users/btracey","html_url":"https://github.com/btracey","followers_url":"https://api.github.com/users/btracey/followers","following_url":"https://api.github.com/users/btracey/following{/other_user}","gists_url":"https://api.github.com/users/btracey/gists{/gist_id}","starred_url":"https://api.github.com/users/btracey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btracey/subscriptions","organizations_url":"https://api.github.com/users/btracey/orgs","repos_url":"https://api.github.com/users/btracey/repos","events_url":"https://api.github.com/users/btracey/events{/privacy}","received_events_url":"https://api.github.com/users/btracey/received_events","type":"User","site_admin":false},"body":"Aha! The problem is that work is a matrix, so work(ib) is really work(ib, 1). Since we're row indexed....\r\n\r\nFixed!","created_at":"2015-10-27T21:27:58Z","updated_at":"2015-10-27T21:27:58Z","html_url":"https://github.com/gonum/lapack/pull/67#discussion_r43190158","pull_request_url":"https://api.github.com/repos/gonum/lapack/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/gonum/lapack/pulls/comments/43190158"},"html":{"href":"https://github.com/gonum/lapack/pull/67#discussion_r43190158"},"pull_request":{"href":"https://api.github.com/repos/gonum/lapack/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/gonum/lapack/pulls/67","id":48905480,"html_url":"https://github.com/gonum/lapack/pull/67","diff_url":"https://github.com/gonum/lapack/pull/67.diff","patch_url":"https://github.com/gonum/lapack/pull/67.patch","issue_url":"https://api.github.com/repos/gonum/lapack/issues/67","number":67,"state":"open","locked":false,"title":"Add dorgqr and tests, update dorg2r tests, and fix cgo dorgqr","user":{"login":"btracey","id":3680859,"avatar_url":"https://avatars.githubusercontent.com/u/3680859?v=3","gravatar_id":"","url":"https://api.github.com/users/btracey","html_url":"https://github.com/btracey","followers_url":"https://api.github.com/users/btracey/followers","following_url":"https://api.github.com/users/btracey/following{/other_user}","gists_url":"https://api.github.com/users/btracey/gists{/gist_id}","starred_url":"https://api.github.com/users/btracey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btracey/subscriptions","organizations_url":"https://api.github.com/users/btracey/orgs","repos_url":"https://api.github.com/users/btracey/repos","events_url":"https://api.github.com/users/btracey/events{/privacy}","received_events_url":"https://api.github.com/users/btracey/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-27T17:37:11Z","updated_at":"2015-10-27T21:27:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eacd26b2468558c7dbf6de133e3e3ea1187a9cc5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gonum/lapack/pulls/67/commits","review_comments_url":"https://api.github.com/repos/gonum/lapack/pulls/67/comments","review_comment_url":"https://api.github.com/repos/gonum/lapack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gonum/lapack/issues/67/comments","statuses_url":"https://api.github.com/repos/gonum/lapack/statuses/84493c285fadd973b4ee579897583f560b8ee173","head":{"label":"gonum:adddorgqr","ref":"adddorgqr","sha":"84493c285fadd973b4ee579897583f560b8ee173","user":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"repo":{"id":20473913,"name":"lapack","full_name":"gonum/lapack","owner":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gonum/lapack","description":"A lapack implementation for go","fork":false,"url":"https://api.github.com/repos/gonum/lapack","forks_url":"https://api.github.com/repos/gonum/lapack/forks","keys_url":"https://api.github.com/repos/gonum/lapack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gonum/lapack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gonum/lapack/teams","hooks_url":"https://api.github.com/repos/gonum/lapack/hooks","issue_events_url":"https://api.github.com/repos/gonum/lapack/issues/events{/number}","events_url":"https://api.github.com/repos/gonum/lapack/events","assignees_url":"https://api.github.com/repos/gonum/lapack/assignees{/user}","branches_url":"https://api.github.com/repos/gonum/lapack/branches{/branch}","tags_url":"https://api.github.com/repos/gonum/lapack/tags","blobs_url":"https://api.github.com/repos/gonum/lapack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gonum/lapack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gonum/lapack/git/refs{/sha}","trees_url":"https://api.github.com/repos/gonum/lapack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gonum/lapack/statuses/{sha}","languages_url":"https://api.github.com/repos/gonum/lapack/languages","stargazers_url":"https://api.github.com/repos/gonum/lapack/stargazers","contributors_url":"https://api.github.com/repos/gonum/lapack/contributors","subscribers_url":"https://api.github.com/repos/gonum/lapack/subscribers","subscription_url":"https://api.github.com/repos/gonum/lapack/subscription","commits_url":"https://api.github.com/repos/gonum/lapack/commits{/sha}","git_commits_url":"https://api.github.com/repos/gonum/lapack/git/commits{/sha}","comments_url":"https://api.github.com/repos/gonum/lapack/comments{/number}","issue_comment_url":"https://api.github.com/repos/gonum/lapack/issues/comments{/number}","contents_url":"https://api.github.com/repos/gonum/lapack/contents/{+path}","compare_url":"https://api.github.com/repos/gonum/lapack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gonum/lapack/merges","archive_url":"https://api.github.com/repos/gonum/lapack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gonum/lapack/downloads","issues_url":"https://api.github.com/repos/gonum/lapack/issues{/number}","pulls_url":"https://api.github.com/repos/gonum/lapack/pulls{/number}","milestones_url":"https://api.github.com/repos/gonum/lapack/milestones{/number}","notifications_url":"https://api.github.com/repos/gonum/lapack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gonum/lapack/labels{/name}","releases_url":"https://api.github.com/repos/gonum/lapack/releases{/id}","created_at":"2014-06-04T07:18:07Z","updated_at":"2015-10-25T16:53:26Z","pushed_at":"2015-10-27T17:41:23Z","git_url":"git://github.com/gonum/lapack.git","ssh_url":"git@github.com:gonum/lapack.git","clone_url":"https://github.com/gonum/lapack.git","svn_url":"https://github.com/gonum/lapack","homepage":null,"size":1100,"stargazers_count":22,"watchers_count":22,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":22,"default_branch":"master"}},"base":{"label":"gonum:master","ref":"master","sha":"676338c65e98f8f7129df3a206d20e6740911285","user":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"repo":{"id":20473913,"name":"lapack","full_name":"gonum/lapack","owner":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gonum/lapack","description":"A lapack implementation for go","fork":false,"url":"https://api.github.com/repos/gonum/lapack","forks_url":"https://api.github.com/repos/gonum/lapack/forks","keys_url":"https://api.github.com/repos/gonum/lapack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gonum/lapack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gonum/lapack/teams","hooks_url":"https://api.github.com/repos/gonum/lapack/hooks","issue_events_url":"https://api.github.com/repos/gonum/lapack/issues/events{/number}","events_url":"https://api.github.com/repos/gonum/lapack/events","assignees_url":"https://api.github.com/repos/gonum/lapack/assignees{/user}","branches_url":"https://api.github.com/repos/gonum/lapack/branches{/branch}","tags_url":"https://api.github.com/repos/gonum/lapack/tags","blobs_url":"https://api.github.com/repos/gonum/lapack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gonum/lapack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gonum/lapack/git/refs{/sha}","trees_url":"https://api.github.com/repos/gonum/lapack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gonum/lapack/statuses/{sha}","languages_url":"https://api.github.com/repos/gonum/lapack/languages","stargazers_url":"https://api.github.com/repos/gonum/lapack/stargazers","contributors_url":"https://api.github.com/repos/gonum/lapack/contributors","subscribers_url":"https://api.github.com/repos/gonum/lapack/subscribers","subscription_url":"https://api.github.com/repos/gonum/lapack/subscription","commits_url":"https://api.github.com/repos/gonum/lapack/commits{/sha}","git_commits_url":"https://api.github.com/repos/gonum/lapack/git/commits{/sha}","comments_url":"https://api.github.com/repos/gonum/lapack/comments{/number}","issue_comment_url":"https://api.github.com/repos/gonum/lapack/issues/comments{/number}","contents_url":"https://api.github.com/repos/gonum/lapack/contents/{+path}","compare_url":"https://api.github.com/repos/gonum/lapack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gonum/lapack/merges","archive_url":"https://api.github.com/repos/gonum/lapack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gonum/lapack/downloads","issues_url":"https://api.github.com/repos/gonum/lapack/issues{/number}","pulls_url":"https://api.github.com/repos/gonum/lapack/pulls{/number}","milestones_url":"https://api.github.com/repos/gonum/lapack/milestones{/number}","notifications_url":"https://api.github.com/repos/gonum/lapack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gonum/lapack/labels{/name}","releases_url":"https://api.github.com/repos/gonum/lapack/releases{/id}","created_at":"2014-06-04T07:18:07Z","updated_at":"2015-10-25T16:53:26Z","pushed_at":"2015-10-27T17:41:23Z","git_url":"git://github.com/gonum/lapack.git","ssh_url":"git@github.com:gonum/lapack.git","clone_url":"https://github.com/gonum/lapack.git","svn_url":"https://github.com/gonum/lapack","homepage":null,"size":1100,"stargazers_count":22,"watchers_count":22,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gonum/lapack/pulls/67"},"html":{"href":"https://github.com/gonum/lapack/pull/67"},"issue":{"href":"https://api.github.com/repos/gonum/lapack/issues/67"},"comments":{"href":"https://api.github.com/repos/gonum/lapack/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/gonum/lapack/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/gonum/lapack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gonum/lapack/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/gonum/lapack/statuses/84493c285fadd973b4ee579897583f560b8ee173"}}}}