{"action":"created","comment":{"url":"https://api.github.com/repos/roboptim/roboptim-core/pulls/comments/28309359","id":28309359,"diff_hunk":"@@ -0,0 +1,114 @@\n+// Copyright (C) 2009 by Thomas Moulard, AIST, CNRS, INRIA.\n+//\n+// This file is part of the roboptim.\n+//\n+// roboptim is free software: you can redistribute it and/or modify\n+// it under the terms of the GNU Lesser 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+// roboptim 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 Lesser General Public License for more details.\n+//\n+// You should have received a copy of the GNU Lesser General Public License\n+// along with roboptim.  If not, see <http://www.gnu.org/licenses/>.\n+\n+#include \"shared-tests/fixture.hh\"\n+\n+#include <iostream>\n+\n+#include <roboptim/core/io.hh>\n+#include <roboptim/core/sum-of-c1-squares.hh>\n+\n+using namespace roboptim;\n+\n+struct F : public DifferentiableFunction\n+{\n+  F () : DifferentiableFunction (4, 2,\n+                                 \"x₀ * x₃ * (x₀ + x₁ + x₂) + x₃, \"\n+                                 \"x₀²\")\n+  {\n+  }\n+\n+  void\n+  impl_compute (result_ref result, const_argument_ref x) const\n+  {\n+    result (0) = x[0] * x[3] * (x[0] + x[1] + x[2]) + x[3];\n+    result (1) = x[0] * x[0];\n+  }\n+\n+  void\n+  impl_gradient (gradient_ref grad, const_argument_ref x,\n+                 size_type functionId) const\n+  {\n+    switch (functionId)\n+    {\n+      case 0:\n+        {\n+          grad[0] = x[0] * x[3] + x[3] * (x[0] + x[1] + x[2]);\n+          grad[1] = x[0] * x[3];\n+          grad[2] = x[0] * x[3] + 1;\n+          grad[3] = x[0] * (x[0] + x[1] + x[2]);\n+        }\n+        break;\n+\n+      case 1:\n+        {\n+          grad[0] = 2. * x[0];\n+        }\n+        break;\n+\n+      default:\n+        abort ();\n+    }\n+  }\n+};\n+\n+BOOST_FIXTURE_TEST_SUITE (core, TestSuiteConfiguration)\n+\n+BOOST_AUTO_TEST_CASE (sum_of_c1_squares)\n+{\n+  boost::shared_ptr<boost::test_tools::output_test_stream>\n+    output = retrievePattern (\"sum-of-c1-squares\");\n+\n+  boost::shared_ptr<F> Fptr =\n+    boost::make_shared<F>();\n+\n+  SumOfC1Squares FSum(Fptr, \"null\");\n+\n+  SumOfC1Squares::vector_t x (4);\n+  x[0] = 1.;\n+  x[1] = 2.;\n+  x[2] = 1.;\n+  x[3] = 2.;\n+  SumOfC1Squares::gradient_t grad (FSum.gradientSize ());\n+\n+  (*output) << FSum << std::endl;\n+\n+  (*output) << FSum.inputSize () << std::endl;\n+\n+  (*output) << FSum.outputSize () << std::endl;\n+\n+  (*output) << FSum.getName () << std::endl;\n+\n+  (*output) << FSum.isValidResult (FSum (x)) << std::endl;\n+\n+  (*output) << FSum (x) << std::endl;","path":"tests/sum-of-c1-squares.cc","position":98,"original_position":98,"commit_id":"5bc1f8d50e7a2bec077de27d23c10d0e6b49f257","original_commit_id":"5bc1f8d50e7a2bec077de27d23c10d0e6b49f257","user":{"login":"bchretien","id":2742231,"avatar_url":"https://avatars.githubusercontent.com/u/2742231?v=3","gravatar_id":"","url":"https://api.github.com/users/bchretien","html_url":"https://github.com/bchretien","followers_url":"https://api.github.com/users/bchretien/followers","following_url":"https://api.github.com/users/bchretien/following{/other_user}","gists_url":"https://api.github.com/users/bchretien/gists{/gist_id}","starred_url":"https://api.github.com/users/bchretien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bchretien/subscriptions","organizations_url":"https://api.github.com/users/bchretien/orgs","repos_url":"https://api.github.com/users/bchretien/repos","events_url":"https://api.github.com/users/bchretien/events{/privacy}","received_events_url":"https://api.github.com/users/bchretien/received_events","type":"User","site_admin":false},"body":"A `BOOST_CHECK(_CLOSE)` with the actual expected value would be nice here. This is stronger than the simple stdout comparison, and this is after all the core result of this class.","created_at":"2015-04-14T08:42:24Z","updated_at":"2015-04-14T08:42:24Z","html_url":"https://github.com/roboptim/roboptim-core/pull/92#discussion_r28309359","pull_request_url":"https://api.github.com/repos/roboptim/roboptim-core/pulls/92","_links":{"self":{"href":"https://api.github.com/repos/roboptim/roboptim-core/pulls/comments/28309359"},"html":{"href":"https://github.com/roboptim/roboptim-core/pull/92#discussion_r28309359"},"pull_request":{"href":"https://api.github.com/repos/roboptim/roboptim-core/pulls/92"}}},"pull_request":{"url":"https://api.github.com/repos/roboptim/roboptim-core/pulls/92","id":33221826,"html_url":"https://github.com/roboptim/roboptim-core/pull/92","diff_url":"https://github.com/roboptim/roboptim-core/pull/92.diff","patch_url":"https://github.com/roboptim/roboptim-core/pull/92.patch","issue_url":"https://api.github.com/repos/roboptim/roboptim-core/issues/92","number":92,"state":"open","locked":false,"title":"Fix #88","user":{"login":"fdarricau","id":11023095,"avatar_url":"https://avatars.githubusercontent.com/u/11023095?v=3","gravatar_id":"","url":"https://api.github.com/users/fdarricau","html_url":"https://github.com/fdarricau","followers_url":"https://api.github.com/users/fdarricau/followers","following_url":"https://api.github.com/users/fdarricau/following{/other_user}","gists_url":"https://api.github.com/users/fdarricau/gists{/gist_id}","starred_url":"https://api.github.com/users/fdarricau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdarricau/subscriptions","organizations_url":"https://api.github.com/users/fdarricau/orgs","repos_url":"https://api.github.com/users/fdarricau/repos","events_url":"https://api.github.com/users/fdarricau/events{/privacy}","received_events_url":"https://api.github.com/users/fdarricau/received_events","type":"User","site_admin":false},"body":"IMHO, the wrapping function set_is_malloc_allowed is probably not optimally placed in the code as it is not supposed to be part of the detail namespace. It is totally possible to move it to a whole new file, or even to core.hh/function.hh (even thought that does not really sounds good to me).\r\n\r\nThe other commits are basically about removing no more needed calls to set_is_malloc_allowed, thanks to the use of Eigen::Ref and making sure each call setting the varaible to true is followed by one setting it to false as soon as the allocation part is done.","created_at":"2015-04-14T02:35:51Z","updated_at":"2015-04-14T08:42:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8243936d848c5e3770b25f3e0fd5dd634b1da795","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/roboptim/roboptim-core/pulls/92/commits","review_comments_url":"https://api.github.com/repos/roboptim/roboptim-core/pulls/92/comments","review_comment_url":"https://api.github.com/repos/roboptim/roboptim-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/roboptim/roboptim-core/issues/92/comments","statuses_url":"https://api.github.com/repos/roboptim/roboptim-core/statuses/5bc1f8d50e7a2bec077de27d23c10d0e6b49f257","head":{"label":"fdarricau:allocation_check","ref":"allocation_check","sha":"5bc1f8d50e7a2bec077de27d23c10d0e6b49f257","user":{"login":"fdarricau","id":11023095,"avatar_url":"https://avatars.githubusercontent.com/u/11023095?v=3","gravatar_id":"","url":"https://api.github.com/users/fdarricau","html_url":"https://github.com/fdarricau","followers_url":"https://api.github.com/users/fdarricau/followers","following_url":"https://api.github.com/users/fdarricau/following{/other_user}","gists_url":"https://api.github.com/users/fdarricau/gists{/gist_id}","starred_url":"https://api.github.com/users/fdarricau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdarricau/subscriptions","organizations_url":"https://api.github.com/users/fdarricau/orgs","repos_url":"https://api.github.com/users/fdarricau/repos","events_url":"https://api.github.com/users/fdarricau/events{/privacy}","received_events_url":"https://api.github.com/users/fdarricau/received_events","type":"User","site_admin":false},"repo":{"id":31193997,"name":"roboptim-core","full_name":"fdarricau/roboptim-core","owner":{"login":"fdarricau","id":11023095,"avatar_url":"https://avatars.githubusercontent.com/u/11023095?v=3","gravatar_id":"","url":"https://api.github.com/users/fdarricau","html_url":"https://github.com/fdarricau","followers_url":"https://api.github.com/users/fdarricau/followers","following_url":"https://api.github.com/users/fdarricau/following{/other_user}","gists_url":"https://api.github.com/users/fdarricau/gists{/gist_id}","starred_url":"https://api.github.com/users/fdarricau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdarricau/subscriptions","organizations_url":"https://api.github.com/users/fdarricau/orgs","repos_url":"https://api.github.com/users/fdarricau/repos","events_url":"https://api.github.com/users/fdarricau/events{/privacy}","received_events_url":"https://api.github.com/users/fdarricau/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fdarricau/roboptim-core","description":"RobOptim Core Layer: interface and basic mathematical tools","fork":true,"url":"https://api.github.com/repos/fdarricau/roboptim-core","forks_url":"https://api.github.com/repos/fdarricau/roboptim-core/forks","keys_url":"https://api.github.com/repos/fdarricau/roboptim-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fdarricau/roboptim-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fdarricau/roboptim-core/teams","hooks_url":"https://api.github.com/repos/fdarricau/roboptim-core/hooks","issue_events_url":"https://api.github.com/repos/fdarricau/roboptim-core/issues/events{/number}","events_url":"https://api.github.com/repos/fdarricau/roboptim-core/events","assignees_url":"https://api.github.com/repos/fdarricau/roboptim-core/assignees{/user}","branches_url":"https://api.github.com/repos/fdarricau/roboptim-core/branches{/branch}","tags_url":"https://api.github.com/repos/fdarricau/roboptim-core/tags","blobs_url":"https://api.github.com/repos/fdarricau/roboptim-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fdarricau/roboptim-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fdarricau/roboptim-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/fdarricau/roboptim-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fdarricau/roboptim-core/statuses/{sha}","languages_url":"https://api.github.com/repos/fdarricau/roboptim-core/languages","stargazers_url":"https://api.github.com/repos/fdarricau/roboptim-core/stargazers","contributors_url":"https://api.github.com/repos/fdarricau/roboptim-core/contributors","subscribers_url":"https://api.github.com/repos/fdarricau/roboptim-core/subscribers","subscription_url":"https://api.github.com/repos/fdarricau/roboptim-core/subscription","commits_url":"https://api.github.com/repos/fdarricau/roboptim-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/fdarricau/roboptim-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/fdarricau/roboptim-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/fdarricau/roboptim-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/fdarricau/roboptim-core/contents/{+path}","compare_url":"https://api.github.com/repos/fdarricau/roboptim-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fdarricau/roboptim-core/merges","archive_url":"https://api.github.com/repos/fdarricau/roboptim-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fdarricau/roboptim-core/downloads","issues_url":"https://api.github.com/repos/fdarricau/roboptim-core/issues{/number}","pulls_url":"https://api.github.com/repos/fdarricau/roboptim-core/pulls{/number}","milestones_url":"https://api.github.com/repos/fdarricau/roboptim-core/milestones{/number}","notifications_url":"https://api.github.com/repos/fdarricau/roboptim-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fdarricau/roboptim-core/labels{/name}","releases_url":"https://api.github.com/repos/fdarricau/roboptim-core/releases{/id}","created_at":"2015-02-23T04:31:28Z","updated_at":"2015-04-14T01:55:49Z","pushed_at":"2015-04-14T08:21:29Z","git_url":"git://github.com/fdarricau/roboptim-core.git","ssh_url":"git@github.com:fdarricau/roboptim-core.git","clone_url":"https://github.com/fdarricau/roboptim-core.git","svn_url":"https://github.com/fdarricau/roboptim-core","homepage":"http://www.roboptim.net","size":54551,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"roboptim:master","ref":"master","sha":"be7c5bc4892078eddfb6572e2ca5a1037253beec","user":{"login":"roboptim","id":2247067,"avatar_url":"https://avatars.githubusercontent.com/u/2247067?v=3","gravatar_id":"","url":"https://api.github.com/users/roboptim","html_url":"https://github.com/roboptim","followers_url":"https://api.github.com/users/roboptim/followers","following_url":"https://api.github.com/users/roboptim/following{/other_user}","gists_url":"https://api.github.com/users/roboptim/gists{/gist_id}","starred_url":"https://api.github.com/users/roboptim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roboptim/subscriptions","organizations_url":"https://api.github.com/users/roboptim/orgs","repos_url":"https://api.github.com/users/roboptim/repos","events_url":"https://api.github.com/users/roboptim/events{/privacy}","received_events_url":"https://api.github.com/users/roboptim/received_events","type":"Organization","site_admin":false},"repo":{"id":890115,"name":"roboptim-core","full_name":"roboptim/roboptim-core","owner":{"login":"roboptim","id":2247067,"avatar_url":"https://avatars.githubusercontent.com/u/2247067?v=3","gravatar_id":"","url":"https://api.github.com/users/roboptim","html_url":"https://github.com/roboptim","followers_url":"https://api.github.com/users/roboptim/followers","following_url":"https://api.github.com/users/roboptim/following{/other_user}","gists_url":"https://api.github.com/users/roboptim/gists{/gist_id}","starred_url":"https://api.github.com/users/roboptim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roboptim/subscriptions","organizations_url":"https://api.github.com/users/roboptim/orgs","repos_url":"https://api.github.com/users/roboptim/repos","events_url":"https://api.github.com/users/roboptim/events{/privacy}","received_events_url":"https://api.github.com/users/roboptim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/roboptim/roboptim-core","description":"RobOptim Core Layer: interface and basic mathematical tools","fork":false,"url":"https://api.github.com/repos/roboptim/roboptim-core","forks_url":"https://api.github.com/repos/roboptim/roboptim-core/forks","keys_url":"https://api.github.com/repos/roboptim/roboptim-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/roboptim/roboptim-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/roboptim/roboptim-core/teams","hooks_url":"https://api.github.com/repos/roboptim/roboptim-core/hooks","issue_events_url":"https://api.github.com/repos/roboptim/roboptim-core/issues/events{/number}","events_url":"https://api.github.com/repos/roboptim/roboptim-core/events","assignees_url":"https://api.github.com/repos/roboptim/roboptim-core/assignees{/user}","branches_url":"https://api.github.com/repos/roboptim/roboptim-core/branches{/branch}","tags_url":"https://api.github.com/repos/roboptim/roboptim-core/tags","blobs_url":"https://api.github.com/repos/roboptim/roboptim-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/roboptim/roboptim-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/roboptim/roboptim-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/roboptim/roboptim-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/roboptim/roboptim-core/statuses/{sha}","languages_url":"https://api.github.com/repos/roboptim/roboptim-core/languages","stargazers_url":"https://api.github.com/repos/roboptim/roboptim-core/stargazers","contributors_url":"https://api.github.com/repos/roboptim/roboptim-core/contributors","subscribers_url":"https://api.github.com/repos/roboptim/roboptim-core/subscribers","subscription_url":"https://api.github.com/repos/roboptim/roboptim-core/subscription","commits_url":"https://api.github.com/repos/roboptim/roboptim-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/roboptim/roboptim-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/roboptim/roboptim-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/roboptim/roboptim-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/roboptim/roboptim-core/contents/{+path}","compare_url":"https://api.github.com/repos/roboptim/roboptim-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/roboptim/roboptim-core/merges","archive_url":"https://api.github.com/repos/roboptim/roboptim-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/roboptim/roboptim-core/downloads","issues_url":"https://api.github.com/repos/roboptim/roboptim-core/issues{/number}","pulls_url":"https://api.github.com/repos/roboptim/roboptim-core/pulls{/number}","milestones_url":"https://api.github.com/repos/roboptim/roboptim-core/milestones{/number}","notifications_url":"https://api.github.com/repos/roboptim/roboptim-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/roboptim/roboptim-core/labels{/name}","releases_url":"https://api.github.com/repos/roboptim/roboptim-core/releases{/id}","created_at":"2010-09-05T21:05:16Z","updated_at":"2015-04-14T01:43:27Z","pushed_at":"2015-04-14T08:21:30Z","git_url":"git://github.com/roboptim/roboptim-core.git","ssh_url":"git@github.com:roboptim/roboptim-core.git","clone_url":"https://github.com/roboptim/roboptim-core.git","svn_url":"https://github.com/roboptim/roboptim-core","homepage":"http://www.roboptim.net","size":26290,"stargazers_count":14,"watchers_count":14,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":16,"forks":13,"open_issues":16,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/roboptim/roboptim-core/pulls/92"},"html":{"href":"https://github.com/roboptim/roboptim-core/pull/92"},"issue":{"href":"https://api.github.com/repos/roboptim/roboptim-core/issues/92"},"comments":{"href":"https://api.github.com/repos/roboptim/roboptim-core/issues/92/comments"},"review_comments":{"href":"https://api.github.com/repos/roboptim/roboptim-core/pulls/92/comments"},"review_comment":{"href":"https://api.github.com/repos/roboptim/roboptim-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/roboptim/roboptim-core/pulls/92/commits"},"statuses":{"href":"https://api.github.com/repos/roboptim/roboptim-core/statuses/5bc1f8d50e7a2bec077de27d23c10d0e6b49f257"}}}}