{"action":"created","comment":{"url":"https://api.github.com/repos/odlgroup/odl/pulls/comments/72438889","id":72438889,"diff_hunk":"@@ -0,0 +1,149 @@\n+.. _functional_in_depth:\n+\n+#####################\n+Functional\n+#####################\n+\n+A *functional* is an operator ``f`` that maps from some vector space ``X`` to the field of scalars ``F`` associated with the vector space:\n+\n+.. math::\n+   \n+   f : X \\to F.\n+\n+In the ODL solver package, functionals are implemented in the `Functional` class, a subclass to `Operator`.\n+\n+From a mathematical presepective, the above is a valide definition of a functional. However, since the purpose of these functionals are primarely to be used for solving optimization problems, the following assumptions are made:\n+\n+ * the vector space ``X`` is a Hilbert space.\n+ * the field of scalars ``F`` are the real numbers.\n+\n+It is possible to use the class without fulfilling these assumtptions, however in this case some of the mathematical results might not hold.\n+\n+\n+Implementation of functionals\n+=============================\n+\n+To define your own functional, you start by writing::\n+\n+    class MyFunctional(odl.solvers.Functional):\n+        ...\n+\n+Since `Functional` is a subclass of `Operator`, it has the *abstract method* ``domain`` which need to be explicitly overridden by any subclass.\n+\n+``domain``: `Set`\n+    The domain of this functional, i.e., the set of elements to which this functional can be applied.\n+\n+Moreover, there are several optional parameters associated with a functional. These are\n+\n+``linear`` : `bool`, optional\n+    If `True`, the functional is considered as linear. In this case, ``domain`` and ``range`` have to be instances of `LinearSpace`, or `Field`.\n+    Default: ``False``\n+smooth : `bool`, optional\n+    If `True`, assume that the functional is continuously differentiable.\n+    Default: ``False``\n+concave : `bool`, optional\n+    If `True`, assume that the functional is concave.\n+    Default: ``False``\n+convex : `bool`, optional\n+    If `True`, assume that the functional is convex.\n+    Default: ``False``\n+grad_lipschitz : 'float', optional\n+    The Lipschitz constant of the gradient.\n+    Default: infinity\n+\n+A functional also has a number of optional methods and properties associated with it. The default value of these are all to raise a `NotImplemetedError`. The properties are:\n+\n+ * ``gradient``. This returns the gradient operator of the functional, i.e., the operator that corresponds to the mapping\n+\n+.. math::\n+\n+    x \\\\to \\\\nabla f(x)\n+\n+where :math:`\\\\nabla f(x)` is the element used to evaluate derivatives in a direction :math:`d` by :math:`\\\\langle \\\\nabla f(x), d \\\\rangle`.\n+ * ``conjugate_functional``. This is the convex conjugate functional, also known as the Legendre transform or Fenchel conjugate. It is defined as \n+\n+.. math::\n+\n+    f^*(x^*) = \\sup_{x \\in X} \\{ \\langle x^*,x \\rangle - f(x)  \\}.\n+\n+For general linear spaces :math:`X`, :math:`x^* \\in X^*` the (continuous/normed) dual space of :math:`X`, i.e., the space of all continuous linear functionals defined on :math:`X`. Then :math:`\\langle x^*,x \\rangle` is the \"dual pairing\", i.e., the evaluation of the linear functional :math:`x^*` in the point :math:`x`. However, Hilbert spaces are self-dual, meaning :math:`X^* = X`, and :math:`\\langle x^*,x \\rangle` is the inner product.\n+\n+The optional method is\n+\n+ * ``proximal(sigma)``. This returns the proximal operator of the functional, where ``sigma`` is a nonnegative step-size like parameter. The proximal operator is defined as\n+\n+.. math::\n+\n+    \\text{prox}_{\\sigma f}(x) = \\text{arg min}_{y \\in X} \\{ f(y) + \\frac{1}{2\\sigma} \\|y - x\\|_2^2 \\}\n+\n+The `Functional` class also contains two default implementations of two help functions:\n+\n+* ``derivative(point)``. Given an implementation of the gradient, this method return the (directional) derivative operator in ``point``. This is the linear operator \n+\n+.. math::\n+    x \\to \\langle x, \\nabla f(point) \\rangle,\n+\n+where :math:`\\nabla f(point)` is the gradient of the functional in the point :math:`point`.\n+* ``translate(shift)``. Give a functional :math:`f(.)`, this method creates the functional :math:`f(. - shift)`","path":"doc/source/guide/in_depth/functional_guide.rst","position":87,"original_position":87,"commit_id":"f22e76288dfc5492d7cfdab38a0b327e3c7a9249","original_commit_id":"f22e76288dfc5492d7cfdab38a0b327e3c7a9249","user":{"login":"aringh","id":15774494,"avatar_url":"https://avatars.githubusercontent.com/u/15774494?v=3","gravatar_id":"","url":"https://api.github.com/users/aringh","html_url":"https://github.com/aringh","followers_url":"https://api.github.com/users/aringh/followers","following_url":"https://api.github.com/users/aringh/following{/other_user}","gists_url":"https://api.github.com/users/aringh/gists{/gist_id}","starred_url":"https://api.github.com/users/aringh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aringh/subscriptions","organizations_url":"https://api.github.com/users/aringh/orgs","repos_url":"https://api.github.com/users/aringh/repos","events_url":"https://api.github.com/users/aringh/events{/privacy}","received_events_url":"https://api.github.com/users/aringh/received_events","type":"User","site_admin":false},"body":"This did not become a new list element","created_at":"2016-07-27T13:31:27Z","updated_at":"2016-07-27T13:31:27Z","html_url":"https://github.com/odlgroup/odl/pull/498#discussion_r72438889","pull_request_url":"https://api.github.com/repos/odlgroup/odl/pulls/498","_links":{"self":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/comments/72438889"},"html":{"href":"https://github.com/odlgroup/odl/pull/498#discussion_r72438889"},"pull_request":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/498"}}},"pull_request":{"url":"https://api.github.com/repos/odlgroup/odl/pulls/498","id":77972925,"html_url":"https://github.com/odlgroup/odl/pull/498","diff_url":"https://github.com/odlgroup/odl/pull/498.diff","patch_url":"https://github.com/odlgroup/odl/pull/498.patch","issue_url":"https://api.github.com/repos/odlgroup/odl/issues/498","number":498,"state":"open","locked":false,"title":"Issue 246  functional","user":{"login":"aringh","id":15774494,"avatar_url":"https://avatars.githubusercontent.com/u/15774494?v=3","gravatar_id":"","url":"https://api.github.com/users/aringh","html_url":"https://github.com/aringh","followers_url":"https://api.github.com/users/aringh/followers","following_url":"https://api.github.com/users/aringh/following{/other_user}","gists_url":"https://api.github.com/users/aringh/gists{/gist_id}","starred_url":"https://api.github.com/users/aringh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aringh/subscriptions","organizations_url":"https://api.github.com/users/aringh/orgs","repos_url":"https://api.github.com/users/aringh/repos","events_url":"https://api.github.com/users/aringh/events{/privacy}","received_events_url":"https://api.github.com/users/aringh/received_events","type":"User","site_admin":false},"body":"This adds `functional`'s to `odl.solvers`.\r\n\r\nThe branch is not complete yet, but review of parts of it can start (especially the basic functionality in the functional-file).\r\n\r\nMoreover, the commit history is not very nice, but I will update this before merge. ","created_at":"2016-07-19T13:11:21Z","updated_at":"2016-07-27T13:31:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3d3e7433b372cdfa2f444c8076c1a0a61da79012","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/odlgroup/odl/pulls/498/commits","review_comments_url":"https://api.github.com/repos/odlgroup/odl/pulls/498/comments","review_comment_url":"https://api.github.com/repos/odlgroup/odl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/odlgroup/odl/issues/498/comments","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/f22e76288dfc5492d7cfdab38a0b327e3c7a9249","head":{"label":"odlgroup:issue-246__functional","ref":"issue-246__functional","sha":"f22e76288dfc5492d7cfdab38a0b327e3c7a9249","user":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":45596393,"name":"odl","full_name":"odlgroup/odl","owner":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odlgroup/odl","description":"Operator Discretization Library","fork":false,"url":"https://api.github.com/repos/odlgroup/odl","forks_url":"https://api.github.com/repos/odlgroup/odl/forks","keys_url":"https://api.github.com/repos/odlgroup/odl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odlgroup/odl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odlgroup/odl/teams","hooks_url":"https://api.github.com/repos/odlgroup/odl/hooks","issue_events_url":"https://api.github.com/repos/odlgroup/odl/issues/events{/number}","events_url":"https://api.github.com/repos/odlgroup/odl/events","assignees_url":"https://api.github.com/repos/odlgroup/odl/assignees{/user}","branches_url":"https://api.github.com/repos/odlgroup/odl/branches{/branch}","tags_url":"https://api.github.com/repos/odlgroup/odl/tags","blobs_url":"https://api.github.com/repos/odlgroup/odl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odlgroup/odl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odlgroup/odl/git/refs{/sha}","trees_url":"https://api.github.com/repos/odlgroup/odl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/{sha}","languages_url":"https://api.github.com/repos/odlgroup/odl/languages","stargazers_url":"https://api.github.com/repos/odlgroup/odl/stargazers","contributors_url":"https://api.github.com/repos/odlgroup/odl/contributors","subscribers_url":"https://api.github.com/repos/odlgroup/odl/subscribers","subscription_url":"https://api.github.com/repos/odlgroup/odl/subscription","commits_url":"https://api.github.com/repos/odlgroup/odl/commits{/sha}","git_commits_url":"https://api.github.com/repos/odlgroup/odl/git/commits{/sha}","comments_url":"https://api.github.com/repos/odlgroup/odl/comments{/number}","issue_comment_url":"https://api.github.com/repos/odlgroup/odl/issues/comments{/number}","contents_url":"https://api.github.com/repos/odlgroup/odl/contents/{+path}","compare_url":"https://api.github.com/repos/odlgroup/odl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odlgroup/odl/merges","archive_url":"https://api.github.com/repos/odlgroup/odl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odlgroup/odl/downloads","issues_url":"https://api.github.com/repos/odlgroup/odl/issues{/number}","pulls_url":"https://api.github.com/repos/odlgroup/odl/pulls{/number}","milestones_url":"https://api.github.com/repos/odlgroup/odl/milestones{/number}","notifications_url":"https://api.github.com/repos/odlgroup/odl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odlgroup/odl/labels{/name}","releases_url":"https://api.github.com/repos/odlgroup/odl/releases{/id}","deployments_url":"https://api.github.com/repos/odlgroup/odl/deployments","created_at":"2015-11-05T07:57:55Z","updated_at":"2016-07-27T12:20:09Z","pushed_at":"2016-07-26T18:45:00Z","git_url":"git://github.com/odlgroup/odl.git","ssh_url":"git@github.com:odlgroup/odl.git","clone_url":"https://github.com/odlgroup/odl.git","svn_url":"https://github.com/odlgroup/odl","homepage":null,"size":19126,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":115,"forks":6,"open_issues":115,"watchers":10,"default_branch":"master"}},"base":{"label":"odlgroup:master","ref":"master","sha":"f89eca6adcc6481d45cef9c02b4feef4424d4080","user":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":45596393,"name":"odl","full_name":"odlgroup/odl","owner":{"login":"odlgroup","id":15667171,"avatar_url":"https://avatars.githubusercontent.com/u/15667171?v=3","gravatar_id":"","url":"https://api.github.com/users/odlgroup","html_url":"https://github.com/odlgroup","followers_url":"https://api.github.com/users/odlgroup/followers","following_url":"https://api.github.com/users/odlgroup/following{/other_user}","gists_url":"https://api.github.com/users/odlgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/odlgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odlgroup/subscriptions","organizations_url":"https://api.github.com/users/odlgroup/orgs","repos_url":"https://api.github.com/users/odlgroup/repos","events_url":"https://api.github.com/users/odlgroup/events{/privacy}","received_events_url":"https://api.github.com/users/odlgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odlgroup/odl","description":"Operator Discretization Library","fork":false,"url":"https://api.github.com/repos/odlgroup/odl","forks_url":"https://api.github.com/repos/odlgroup/odl/forks","keys_url":"https://api.github.com/repos/odlgroup/odl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odlgroup/odl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odlgroup/odl/teams","hooks_url":"https://api.github.com/repos/odlgroup/odl/hooks","issue_events_url":"https://api.github.com/repos/odlgroup/odl/issues/events{/number}","events_url":"https://api.github.com/repos/odlgroup/odl/events","assignees_url":"https://api.github.com/repos/odlgroup/odl/assignees{/user}","branches_url":"https://api.github.com/repos/odlgroup/odl/branches{/branch}","tags_url":"https://api.github.com/repos/odlgroup/odl/tags","blobs_url":"https://api.github.com/repos/odlgroup/odl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odlgroup/odl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odlgroup/odl/git/refs{/sha}","trees_url":"https://api.github.com/repos/odlgroup/odl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odlgroup/odl/statuses/{sha}","languages_url":"https://api.github.com/repos/odlgroup/odl/languages","stargazers_url":"https://api.github.com/repos/odlgroup/odl/stargazers","contributors_url":"https://api.github.com/repos/odlgroup/odl/contributors","subscribers_url":"https://api.github.com/repos/odlgroup/odl/subscribers","subscription_url":"https://api.github.com/repos/odlgroup/odl/subscription","commits_url":"https://api.github.com/repos/odlgroup/odl/commits{/sha}","git_commits_url":"https://api.github.com/repos/odlgroup/odl/git/commits{/sha}","comments_url":"https://api.github.com/repos/odlgroup/odl/comments{/number}","issue_comment_url":"https://api.github.com/repos/odlgroup/odl/issues/comments{/number}","contents_url":"https://api.github.com/repos/odlgroup/odl/contents/{+path}","compare_url":"https://api.github.com/repos/odlgroup/odl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odlgroup/odl/merges","archive_url":"https://api.github.com/repos/odlgroup/odl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odlgroup/odl/downloads","issues_url":"https://api.github.com/repos/odlgroup/odl/issues{/number}","pulls_url":"https://api.github.com/repos/odlgroup/odl/pulls{/number}","milestones_url":"https://api.github.com/repos/odlgroup/odl/milestones{/number}","notifications_url":"https://api.github.com/repos/odlgroup/odl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odlgroup/odl/labels{/name}","releases_url":"https://api.github.com/repos/odlgroup/odl/releases{/id}","deployments_url":"https://api.github.com/repos/odlgroup/odl/deployments","created_at":"2015-11-05T07:57:55Z","updated_at":"2016-07-27T12:20:09Z","pushed_at":"2016-07-26T18:45:00Z","git_url":"git://github.com/odlgroup/odl.git","ssh_url":"git@github.com:odlgroup/odl.git","clone_url":"https://github.com/odlgroup/odl.git","svn_url":"https://github.com/odlgroup/odl","homepage":null,"size":19126,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":115,"forks":6,"open_issues":115,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/498"},"html":{"href":"https://github.com/odlgroup/odl/pull/498"},"issue":{"href":"https://api.github.com/repos/odlgroup/odl/issues/498"},"comments":{"href":"https://api.github.com/repos/odlgroup/odl/issues/498/comments"},"review_comments":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/498/comments"},"review_comment":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/odlgroup/odl/pulls/498/commits"},"statuses":{"href":"https://api.github.com/repos/odlgroup/odl/statuses/f22e76288dfc5492d7cfdab38a0b327e3c7a9249"}}}}
{"actor":{"display_login":"aringh"}}