{"action":"created","comment":{"url":"https://api.github.com/repos/dealii/dealii/pulls/comments/38941796","id":38941796,"diff_hunk":"@@ -1111,6 +1111,112 @@ linear_operator(const OperatorExemplar &operator_exemplar, const Matrix &matrix)\n   return return_op;\n }\n \n+template <typename Range = Vector<double>,\n+          typename Domain = Range,\n+          typename Matrix>\n+LinearOperator<Range, Domain>\n+constraints_linear_operator(const ConstraintMatrix &, const Matrix &);\n+\n+/**\n+ * @relates LinearOperator\n+ *\n+ * constraints_linear_operator takes a constraint matrix @p cm and an exemplar\n+ * matrix @p (this matrix could be the system matrix).\n+ * The result of this function is the LinearOperator associated to the constraint\n+ * matrix.\n+ *\n+ * [ see M. S. Shephard:. Linear multipoint constraints applied via\n+ * transformation as part of a direct stiffness assembly process., 1985.\n+ * for more deatails ]\n+ *\n+ * @ingroup LAOperators\n+ */\n+template <  typename Range,\n+            typename Domain,\n+            typename Matrix >\n+LinearOperator<Range, Domain>\n+constraints_linear_operator(const ConstraintMatrix &cm, const Matrix &m)\n+{\n+  LinearOperator<Range, Domain> return_op = linear_operator<Range, Domain>(m);\n+\n+  return_op.vmult = [&cm](Range &v, const Domain &u)\n+  {\n+    for (auto i : v.locally_owned_elements())\n+      {\n+        if (cm.is_constrained(i))\n+          {\n+            v(i) = 0;\n+            const std::vector< std::pair < types::global_dof_index, double > >\n+            *entries = cm.get_constraint_entries (i);\n+            for (types::global_dof_index j=0; j < entries->size(); ++j)\n+              {\n+                types::global_dof_index pos = (*entries)[j].first;\n+                v(i) +=  u(pos) * (*entries)[j].second;\n+              }\n+          }\n+        else\n+          v(i) = u(i);\n+      }\n+  };\n+\n+  return_op.Tvmult = [&cm](Range &v, const Domain &u)\n+  {\n+    for (auto i : u.locally_owned_elements())\n+      {\n+        if (cm.is_constrained(i))\n+          {\n+            v(i)=0;\n+            const std::vector< std::pair < types::global_dof_index, double > >\n+            *entries = cm.get_constraint_entries (i);\n+            for (types::global_dof_index j=0; j < entries->size(); ++j)\n+              {\n+                types::global_dof_index pos = (*entries)[j].first;\n+                v(pos) += u(i) * (*entries)[j].second;\n+              }\n+          }\n+        else\n+          v(i)=u(i);\n+\n+      }\n+  };\n+\n+  return return_op;\n+}\n+\n+template <typename Range = Vector<double>,\n+          typename Domain = Range,\n+          typename Matrix>\n+LinearOperator<Range, Domain>\n+constrained_linear_operator(const ConstraintMatrix &, const Matrix &);\n+\n+/**\n+ * @relates LinearOperator\n+ *\n+ * Let @p m be a system matrix and assume we are interested in this problem\n+ * constrained with a constraint matrix @p cm.\n+ * This function returns the LinearOperator that replace the system matrix and\n+ * is associated to this problem.","path":"include/deal.II/lac/linear_operator.h","position":97,"original_position":88,"commit_id":"2a040f8978ed24b16ae9b740593f41f3ec138fd4","original_commit_id":"0efb52f0c58556834dd5145430dfddf025181799","user":{"login":"ESeNonFossiIo","id":8956997,"avatar_url":"https://avatars.githubusercontent.com/u/8956997?v=3","gravatar_id":"","url":"https://api.github.com/users/ESeNonFossiIo","html_url":"https://github.com/ESeNonFossiIo","followers_url":"https://api.github.com/users/ESeNonFossiIo/followers","following_url":"https://api.github.com/users/ESeNonFossiIo/following{/other_user}","gists_url":"https://api.github.com/users/ESeNonFossiIo/gists{/gist_id}","starred_url":"https://api.github.com/users/ESeNonFossiIo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ESeNonFossiIo/subscriptions","organizations_url":"https://api.github.com/users/ESeNonFossiIo/orgs","repos_url":"https://api.github.com/users/ESeNonFossiIo/repos","events_url":"https://api.github.com/users/ESeNonFossiIo/events{/privacy}","received_events_url":"https://api.github.com/users/ESeNonFossiIo/received_events","type":"User","site_admin":false},"body":"I wrote some lines. Should I be more verbose?\r\nShould I copy and past this part under other functions?","created_at":"2015-09-08T15:43:45Z","updated_at":"2015-09-08T15:43:45Z","html_url":"https://github.com/dealii/dealii/pull/1543#discussion_r38941796","pull_request_url":"https://api.github.com/repos/dealii/dealii/pulls/1543","_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments/38941796"},"html":{"href":"https://github.com/dealii/dealii/pull/1543#discussion_r38941796"},"pull_request":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1543"}}},"pull_request":{"url":"https://api.github.com/repos/dealii/dealii/pulls/1543","id":44368102,"html_url":"https://github.com/dealii/dealii/pull/1543","diff_url":"https://github.com/dealii/dealii/pull/1543.diff","patch_url":"https://github.com/dealii/dealii/pull/1543.patch","issue_url":"https://api.github.com/repos/dealii/dealii/issues/1543","number":1543,"state":"open","locked":false,"title":"Constraint Linear Operator","user":{"login":"ESeNonFossiIo","id":8956997,"avatar_url":"https://avatars.githubusercontent.com/u/8956997?v=3","gravatar_id":"","url":"https://api.github.com/users/ESeNonFossiIo","html_url":"https://github.com/ESeNonFossiIo","followers_url":"https://api.github.com/users/ESeNonFossiIo/followers","following_url":"https://api.github.com/users/ESeNonFossiIo/following{/other_user}","gists_url":"https://api.github.com/users/ESeNonFossiIo/gists{/gist_id}","starred_url":"https://api.github.com/users/ESeNonFossiIo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ESeNonFossiIo/subscriptions","organizations_url":"https://api.github.com/users/ESeNonFossiIo/orgs","repos_url":"https://api.github.com/users/ESeNonFossiIo/repos","events_url":"https://api.github.com/users/ESeNonFossiIo/events{/privacy}","received_events_url":"https://api.github.com/users/ESeNonFossiIo/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-07T16:03:12Z","updated_at":"2015-09-08T15:43:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"449b55f9670b2201cb72d8e434b860e9a2554e32","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dealii/dealii/pulls/1543/commits","review_comments_url":"https://api.github.com/repos/dealii/dealii/pulls/1543/comments","review_comment_url":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dealii/dealii/issues/1543/comments","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/2a040f8978ed24b16ae9b740593f41f3ec138fd4","head":{"label":"ESeNonFossiIo:constraint","ref":"constraint","sha":"2a040f8978ed24b16ae9b740593f41f3ec138fd4","user":{"login":"ESeNonFossiIo","id":8956997,"avatar_url":"https://avatars.githubusercontent.com/u/8956997?v=3","gravatar_id":"","url":"https://api.github.com/users/ESeNonFossiIo","html_url":"https://github.com/ESeNonFossiIo","followers_url":"https://api.github.com/users/ESeNonFossiIo/followers","following_url":"https://api.github.com/users/ESeNonFossiIo/following{/other_user}","gists_url":"https://api.github.com/users/ESeNonFossiIo/gists{/gist_id}","starred_url":"https://api.github.com/users/ESeNonFossiIo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ESeNonFossiIo/subscriptions","organizations_url":"https://api.github.com/users/ESeNonFossiIo/orgs","repos_url":"https://api.github.com/users/ESeNonFossiIo/repos","events_url":"https://api.github.com/users/ESeNonFossiIo/events{/privacy}","received_events_url":"https://api.github.com/users/ESeNonFossiIo/received_events","type":"User","site_admin":false},"repo":{"id":33110155,"name":"dealii","full_name":"ESeNonFossiIo/dealii","owner":{"login":"ESeNonFossiIo","id":8956997,"avatar_url":"https://avatars.githubusercontent.com/u/8956997?v=3","gravatar_id":"","url":"https://api.github.com/users/ESeNonFossiIo","html_url":"https://github.com/ESeNonFossiIo","followers_url":"https://api.github.com/users/ESeNonFossiIo/followers","following_url":"https://api.github.com/users/ESeNonFossiIo/following{/other_user}","gists_url":"https://api.github.com/users/ESeNonFossiIo/gists{/gist_id}","starred_url":"https://api.github.com/users/ESeNonFossiIo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ESeNonFossiIo/subscriptions","organizations_url":"https://api.github.com/users/ESeNonFossiIo/orgs","repos_url":"https://api.github.com/users/ESeNonFossiIo/repos","events_url":"https://api.github.com/users/ESeNonFossiIo/events{/privacy}","received_events_url":"https://api.github.com/users/ESeNonFossiIo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ESeNonFossiIo/dealii","description":"The development repository for the deal.II finite element library.","fork":true,"url":"https://api.github.com/repos/ESeNonFossiIo/dealii","forks_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/forks","keys_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/teams","hooks_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/hooks","issue_events_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/events","assignees_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/tags","blobs_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/languages","stargazers_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/stargazers","contributors_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/contributors","subscribers_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/subscribers","subscription_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/subscription","commits_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/merges","archive_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/downloads","issues_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/labels{/name}","releases_url":"https://api.github.com/repos/ESeNonFossiIo/dealii/releases{/id}","created_at":"2015-03-30T07:57:41Z","updated_at":"2015-05-06T15:24:04Z","pushed_at":"2015-09-08T15:41:00Z","git_url":"git://github.com/ESeNonFossiIo/dealii.git","ssh_url":"git@github.com:ESeNonFossiIo/dealii.git","clone_url":"https://github.com/ESeNonFossiIo/dealii.git","svn_url":"https://github.com/ESeNonFossiIo/dealii","homepage":"http://www.dealii.org/","size":124310,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dealii:master","ref":"master","sha":"db3a64721d656d0cac1a630b7714eed5c4e5670f","user":{"login":"dealii","id":7506070,"avatar_url":"https://avatars.githubusercontent.com/u/7506070?v=3","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"repo":{"id":21943980,"name":"dealii","full_name":"dealii/dealii","owner":{"login":"dealii","id":7506070,"avatar_url":"https://avatars.githubusercontent.com/u/7506070?v=3","gravatar_id":"","url":"https://api.github.com/users/dealii","html_url":"https://github.com/dealii","followers_url":"https://api.github.com/users/dealii/followers","following_url":"https://api.github.com/users/dealii/following{/other_user}","gists_url":"https://api.github.com/users/dealii/gists{/gist_id}","starred_url":"https://api.github.com/users/dealii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dealii/subscriptions","organizations_url":"https://api.github.com/users/dealii/orgs","repos_url":"https://api.github.com/users/dealii/repos","events_url":"https://api.github.com/users/dealii/events{/privacy}","received_events_url":"https://api.github.com/users/dealii/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dealii/dealii","description":"The development repository for the deal.II finite element library.","fork":false,"url":"https://api.github.com/repos/dealii/dealii","forks_url":"https://api.github.com/repos/dealii/dealii/forks","keys_url":"https://api.github.com/repos/dealii/dealii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dealii/dealii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dealii/dealii/teams","hooks_url":"https://api.github.com/repos/dealii/dealii/hooks","issue_events_url":"https://api.github.com/repos/dealii/dealii/issues/events{/number}","events_url":"https://api.github.com/repos/dealii/dealii/events","assignees_url":"https://api.github.com/repos/dealii/dealii/assignees{/user}","branches_url":"https://api.github.com/repos/dealii/dealii/branches{/branch}","tags_url":"https://api.github.com/repos/dealii/dealii/tags","blobs_url":"https://api.github.com/repos/dealii/dealii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dealii/dealii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dealii/dealii/git/refs{/sha}","trees_url":"https://api.github.com/repos/dealii/dealii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dealii/dealii/statuses/{sha}","languages_url":"https://api.github.com/repos/dealii/dealii/languages","stargazers_url":"https://api.github.com/repos/dealii/dealii/stargazers","contributors_url":"https://api.github.com/repos/dealii/dealii/contributors","subscribers_url":"https://api.github.com/repos/dealii/dealii/subscribers","subscription_url":"https://api.github.com/repos/dealii/dealii/subscription","commits_url":"https://api.github.com/repos/dealii/dealii/commits{/sha}","git_commits_url":"https://api.github.com/repos/dealii/dealii/git/commits{/sha}","comments_url":"https://api.github.com/repos/dealii/dealii/comments{/number}","issue_comment_url":"https://api.github.com/repos/dealii/dealii/issues/comments{/number}","contents_url":"https://api.github.com/repos/dealii/dealii/contents/{+path}","compare_url":"https://api.github.com/repos/dealii/dealii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dealii/dealii/merges","archive_url":"https://api.github.com/repos/dealii/dealii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dealii/dealii/downloads","issues_url":"https://api.github.com/repos/dealii/dealii/issues{/number}","pulls_url":"https://api.github.com/repos/dealii/dealii/pulls{/number}","milestones_url":"https://api.github.com/repos/dealii/dealii/milestones{/number}","notifications_url":"https://api.github.com/repos/dealii/dealii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dealii/dealii/labels{/name}","releases_url":"https://api.github.com/repos/dealii/dealii/releases{/id}","created_at":"2014-07-17T14:00:26Z","updated_at":"2015-09-02T19:23:15Z","pushed_at":"2015-09-08T15:41:01Z","git_url":"git://github.com/dealii/dealii.git","ssh_url":"git@github.com:dealii/dealii.git","clone_url":"https://github.com/dealii/dealii.git","svn_url":"https://github.com/dealii/dealii","homepage":"http://www.dealii.org/","size":159627,"stargazers_count":82,"watchers_count":82,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":117,"mirror_url":null,"open_issues_count":120,"forks":117,"open_issues":120,"watchers":82,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1543"},"html":{"href":"https://github.com/dealii/dealii/pull/1543"},"issue":{"href":"https://api.github.com/repos/dealii/dealii/issues/1543"},"comments":{"href":"https://api.github.com/repos/dealii/dealii/issues/1543/comments"},"review_comments":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1543/comments"},"review_comment":{"href":"https://api.github.com/repos/dealii/dealii/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dealii/dealii/pulls/1543/commits"},"statuses":{"href":"https://api.github.com/repos/dealii/dealii/statuses/2a040f8978ed24b16ae9b740593f41f3ec138fd4"}}}}