{"action":"created","comment":{"url":"https://api.github.com/repos/amaggiulli/QLNet/pulls/comments/141140648","pull_request_review_id":65312283,"id":141140648,"diff_hunk":"@@ -0,0 +1,126 @@\n+﻿/*\n+ Copyright (C) 2008 Andreas Gaida\n+ Copyright (C) 2008 Ralph Schreyer\n+ Copyright (C) 2008 Klaus Spanderen\n+ Copyright (C) 2017 Jean-Camille Tournier (jean-camille.tournier@avivainvestors.com)\n+ \n+ This file is part of QLNet Project https://github.com/amaggiulli/qlnet\n+\n+ QLNet is free software: you can redistribute it and/or modify it\n+ under the terms of the QLNet license.  You should have received a\n+ copy of the license along with this program; if not, license is  \n+ available online at <http://qlnet.sourceforge.net/License.html>.\n+  \n+ QLNet is a based on QuantLib, a free-software/open-source library\n+ for financial quantitative analysts and developers - http://quantlib.org/\n+ The QuantLib license is available online at http://quantlib.org/license.shtml.\n+ \n+ This program is distributed in the hope that it will be useful, but WITHOUT\n+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n+ FOR A PARTICULAR PURPOSE.  See the license for more details.\n+*/\n+using System;\n+\n+namespace QLNet\n+{\n+    public class SecondOrderMixedDerivativeOp : NinePointLinearOp\n+    {\n+        public SecondOrderMixedDerivativeOp(int d0, int d1, FdmMesher mesher)\n+            : base (d0, d1, mesher)\n+        {\n+            FdmLinearOpLayout layout = mesher.layout();\n+            FdmLinearOpIterator endIter = layout.end();\n+\n+            for (FdmLinearOpIterator iter = layout.begin(); iter != endIter; ++iter)\n+            {\n+                int i = iter.index();\n+                double? hm_d0 = mesher.dminus(iter, d0_);\n+                double? hp_d0 = mesher.dplus(iter, d0_);\n+                double? hm_d1 = mesher.dminus(iter, d1_);\n+                double? hp_d1 = mesher.dplus(iter, d1_);\n+\n+                double? zetam1 = hm_d0 * (hm_d0 + hp_d0);\n+                double? zeta0 = hm_d0 * hp_d0;\n+                double? zetap1 = hp_d0 * (hm_d0 + hp_d0);\n+                double? phim1 = hm_d1 * (hm_d1 + hp_d1);\n+                double? phi0 = hm_d1 * hp_d1;\n+                double? phip1 = hp_d1 * (hm_d1 + hp_d1);\n+\n+                int c0 = iter.coordinates()[d0_];\n+                int c1 = iter.coordinates()[d1_];\n+                if (c0 == 0 && c1 == 0)\n+                {\n+                    // lower left corner\n+                    a00_[i] = a01_[i] = a02_[i] = a10_[i] = a20_[i] = 0.0;\n+                    a21_[i] = a12_[i] = -(a11_[i] = a22_[i] = 1.0 / (hp_d0.Value * hp_d1.Value));\n+                }\n+                else if (c0 == layout.dim()[d0_] - 1 && c1 == 0)\n+                {\n+                    // upper left corner\n+                    a22_[i] = a21_[i] = a20_[i] = a10_[i] = a00_[i] = 0.0;\n+                    a11_[i] = a02_[i] = -(a01_[i] = a12_[i] = 1.0 / (hm_d0.Value * hp_d1.Value));\n+                }\n+                else if (c0 == 0 && c1 == layout.dim()[d1_] - 1)\n+                {\n+                    // lower right corner\n+                    a00_[i] = a01_[i] = a02_[i] = a12_[i] = a22_[i] = 0.0;\n+                    a20_[i] = a11_[i] = -(a10_[i] = a21_[i] = 1.0 / (hp_d0.Value * hm_d1.Value));\n+                }\n+                else if (c0 == layout.dim()[d0_] - 1 && c1 == layout.dim()[d1_] - 1)\n+                {\n+                    // upper right corner\n+                    a20_[i] = a21_[i] = a22_[i] = a12_[i] = a02_[i] = 0.0;\n+                    a10_[i] = a01_[i] = -(a00_[i] = a11_[i] = 1.0 / (hm_d0.Value * hm_d1.Value));\n+                }\n+                else if (c0 == 0)\n+                {\n+                    // lower side\n+                    a00_[i] = a01_[i] = a02_[i] = 0.0;\n+\n+                    a20_[i] = -(a10_[i] = hp_d1.Value / (hp_d0.Value * phim1.Value));\n+                    a11_[i] = -(a21_[i] = (hp_d1.Value - hm_d1.Value) / (hp_d0.Value * phi0.Value));\n+                    a12_[i] = -(a22_[i] = hm_d1.Value / (hp_d0.Value * phip1.Value));\n+                }\n+                else if (c0 == layout.dim()[d0_] - 1)\n+                {\n+                    // upper side\n+                    a20_[i] = a21_[i] = a22_[i] = 0.0;\n+\n+                    a10_[i] = -(a00_[i] = hp_d1.Value / (hm_d0.Value * phim1.Value));\n+                    a01_[i] = -(a11_[i] = (hp_d1.Value - hm_d1.Value) / (hm_d0.Value * phi0.Value));\n+                    a02_[i] = -(a12_[i] = hm_d1.Value / (hm_d0.Value * phip1.Value));\n+                }\n+                else if (c1 == 0)\n+                {\n+                    // left side\n+                    a00_[i] = a10_[i] = a20_[i] = 0.0;\n+\n+                    a02_[i] = -(a01_[i] = hp_d0.Value / (zetam1.Value * hp_d1.Value));\n+                    a11_[i] = -(a12_[i] = (hp_d0.Value - hm_d0.Value) / (zeta0.Value * hp_d1.Value));\n+                    a21_[i] = -(a22_[i] = hm_d0.Value / (zetap1.Value * hp_d1.Value));\n+                }\n+                else if (c1 == layout.dim()[d1_] - 1)\n+                {\n+                    // right side\n+                    a22_[i] = a12_[i] = a02_[i] = 0.0;\n+\n+                    a01_[i] = -(a00_[i] = hp_d0.Value / (zetam1.Value * hm_d1.Value));","path":"src/QLNet/Methods/Finitedifferences/Operators/SecondOrderMixedDerivativeOp.cs","position":107,"original_position":107,"commit_id":"0cb99dcc6e7df1b5a152a34431ca875816d12495","original_commit_id":"0cb99dcc6e7df1b5a152a34431ca875816d12495","user":{"login":"amaggiulli","id":5287576,"avatar_url":"https://avatars2.githubusercontent.com/u/5287576?v=4","gravatar_id":"","url":"https://api.github.com/users/amaggiulli","html_url":"https://github.com/amaggiulli","followers_url":"https://api.github.com/users/amaggiulli/followers","following_url":"https://api.github.com/users/amaggiulli/following{/other_user}","gists_url":"https://api.github.com/users/amaggiulli/gists{/gist_id}","starred_url":"https://api.github.com/users/amaggiulli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amaggiulli/subscriptions","organizations_url":"https://api.github.com/users/amaggiulli/orgs","repos_url":"https://api.github.com/users/amaggiulli/repos","events_url":"https://api.github.com/users/amaggiulli/events{/privacy}","received_events_url":"https://api.github.com/users/amaggiulli/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://sonarsource.github.io/sonar-github/severity-major.png 'Severity: MAJOR') Extract the assignment of 'a00_[i]' from this expression. [![rule](https://sonarsource.github.io/sonar-github/rule.png)](https://sonarcloud.io/coding_rules#rule_key=csharpsquid%3AS1121)\n","created_at":"2017-09-26T18:19:31Z","updated_at":"2017-09-26T18:19:31Z","html_url":"https://github.com/amaggiulli/QLNet/pull/172#discussion_r141140648","pull_request_url":"https://api.github.com/repos/amaggiulli/QLNet/pulls/172","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/amaggiulli/QLNet/pulls/comments/141140648"},"html":{"href":"https://github.com/amaggiulli/QLNet/pull/172#discussion_r141140648"},"pull_request":{"href":"https://api.github.com/repos/amaggiulli/QLNet/pulls/172"}}},"pull_request":{"url":"https://api.github.com/repos/amaggiulli/QLNet/pulls/172","id":143205555,"html_url":"https://github.com/amaggiulli/QLNet/pull/172","diff_url":"https://github.com/amaggiulli/QLNet/pull/172.diff","patch_url":"https://github.com/amaggiulli/QLNet/pull/172.patch","issue_url":"https://api.github.com/repos/amaggiulli/QLNet/issues/172","number":172,"state":"open","locked":false,"title":"Finite differences method port","user":{"login":"jiskin","id":24534916,"avatar_url":"https://avatars0.githubusercontent.com/u/24534916?v=4","gravatar_id":"","url":"https://api.github.com/users/jiskin","html_url":"https://github.com/jiskin","followers_url":"https://api.github.com/users/jiskin/followers","following_url":"https://api.github.com/users/jiskin/following{/other_user}","gists_url":"https://api.github.com/users/jiskin/gists{/gist_id}","starred_url":"https://api.github.com/users/jiskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiskin/subscriptions","organizations_url":"https://api.github.com/users/jiskin/orgs","repos_url":"https://api.github.com/users/jiskin/repos","events_url":"https://api.github.com/users/jiskin/events{/privacy}","received_events_url":"https://api.github.com/users/jiskin/received_events","type":"User","site_admin":false},"body":"First port of Finite differences method from Quantlib","created_at":"2017-09-26T18:11:11Z","updated_at":"2017-09-26T18:19:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"799d8486f3282f69d5728c185c0c5da4c705cd4a","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/amaggiulli/QLNet/pulls/172/commits","review_comments_url":"https://api.github.com/repos/amaggiulli/QLNet/pulls/172/comments","review_comment_url":"https://api.github.com/repos/amaggiulli/QLNet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amaggiulli/QLNet/issues/172/comments","statuses_url":"https://api.github.com/repos/amaggiulli/QLNet/statuses/0cb99dcc6e7df1b5a152a34431ca875816d12495","head":{"label":"jiskin:FiniteDifferencesMethod_Port","ref":"FiniteDifferencesMethod_Port","sha":"0cb99dcc6e7df1b5a152a34431ca875816d12495","user":{"login":"jiskin","id":24534916,"avatar_url":"https://avatars0.githubusercontent.com/u/24534916?v=4","gravatar_id":"","url":"https://api.github.com/users/jiskin","html_url":"https://github.com/jiskin","followers_url":"https://api.github.com/users/jiskin/followers","following_url":"https://api.github.com/users/jiskin/following{/other_user}","gists_url":"https://api.github.com/users/jiskin/gists{/gist_id}","starred_url":"https://api.github.com/users/jiskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiskin/subscriptions","organizations_url":"https://api.github.com/users/jiskin/orgs","repos_url":"https://api.github.com/users/jiskin/repos","events_url":"https://api.github.com/users/jiskin/events{/privacy}","received_events_url":"https://api.github.com/users/jiskin/received_events","type":"User","site_admin":false},"repo":{"id":97472345,"name":"QLNet","full_name":"jiskin/QLNet","owner":{"login":"jiskin","id":24534916,"avatar_url":"https://avatars0.githubusercontent.com/u/24534916?v=4","gravatar_id":"","url":"https://api.github.com/users/jiskin","html_url":"https://github.com/jiskin","followers_url":"https://api.github.com/users/jiskin/followers","following_url":"https://api.github.com/users/jiskin/following{/other_user}","gists_url":"https://api.github.com/users/jiskin/gists{/gist_id}","starred_url":"https://api.github.com/users/jiskin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiskin/subscriptions","organizations_url":"https://api.github.com/users/jiskin/orgs","repos_url":"https://api.github.com/users/jiskin/repos","events_url":"https://api.github.com/users/jiskin/events{/privacy}","received_events_url":"https://api.github.com/users/jiskin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jiskin/QLNet","description":"QLNet C# Library","fork":true,"url":"https://api.github.com/repos/jiskin/QLNet","forks_url":"https://api.github.com/repos/jiskin/QLNet/forks","keys_url":"https://api.github.com/repos/jiskin/QLNet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jiskin/QLNet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jiskin/QLNet/teams","hooks_url":"https://api.github.com/repos/jiskin/QLNet/hooks","issue_events_url":"https://api.github.com/repos/jiskin/QLNet/issues/events{/number}","events_url":"https://api.github.com/repos/jiskin/QLNet/events","assignees_url":"https://api.github.com/repos/jiskin/QLNet/assignees{/user}","branches_url":"https://api.github.com/repos/jiskin/QLNet/branches{/branch}","tags_url":"https://api.github.com/repos/jiskin/QLNet/tags","blobs_url":"https://api.github.com/repos/jiskin/QLNet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jiskin/QLNet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jiskin/QLNet/git/refs{/sha}","trees_url":"https://api.github.com/repos/jiskin/QLNet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jiskin/QLNet/statuses/{sha}","languages_url":"https://api.github.com/repos/jiskin/QLNet/languages","stargazers_url":"https://api.github.com/repos/jiskin/QLNet/stargazers","contributors_url":"https://api.github.com/repos/jiskin/QLNet/contributors","subscribers_url":"https://api.github.com/repos/jiskin/QLNet/subscribers","subscription_url":"https://api.github.com/repos/jiskin/QLNet/subscription","commits_url":"https://api.github.com/repos/jiskin/QLNet/commits{/sha}","git_commits_url":"https://api.github.com/repos/jiskin/QLNet/git/commits{/sha}","comments_url":"https://api.github.com/repos/jiskin/QLNet/comments{/number}","issue_comment_url":"https://api.github.com/repos/jiskin/QLNet/issues/comments{/number}","contents_url":"https://api.github.com/repos/jiskin/QLNet/contents/{+path}","compare_url":"https://api.github.com/repos/jiskin/QLNet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jiskin/QLNet/merges","archive_url":"https://api.github.com/repos/jiskin/QLNet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jiskin/QLNet/downloads","issues_url":"https://api.github.com/repos/jiskin/QLNet/issues{/number}","pulls_url":"https://api.github.com/repos/jiskin/QLNet/pulls{/number}","milestones_url":"https://api.github.com/repos/jiskin/QLNet/milestones{/number}","notifications_url":"https://api.github.com/repos/jiskin/QLNet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jiskin/QLNet/labels{/name}","releases_url":"https://api.github.com/repos/jiskin/QLNet/releases{/id}","deployments_url":"https://api.github.com/repos/jiskin/QLNet/deployments","created_at":"2017-07-17T12:11:40Z","updated_at":"2017-07-17T12:11:43Z","pushed_at":"2017-09-26T18:10:21Z","git_url":"git://github.com/jiskin/QLNet.git","ssh_url":"git@github.com:jiskin/QLNet.git","clone_url":"https://github.com/jiskin/QLNet.git","svn_url":"https://github.com/jiskin/QLNet","homepage":"","size":8324,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"amaggiulli:develop","ref":"develop","sha":"1a0822c1de59823b45ddee5d5bfec85c7e185ba5","user":{"login":"amaggiulli","id":5287576,"avatar_url":"https://avatars2.githubusercontent.com/u/5287576?v=4","gravatar_id":"","url":"https://api.github.com/users/amaggiulli","html_url":"https://github.com/amaggiulli","followers_url":"https://api.github.com/users/amaggiulli/followers","following_url":"https://api.github.com/users/amaggiulli/following{/other_user}","gists_url":"https://api.github.com/users/amaggiulli/gists{/gist_id}","starred_url":"https://api.github.com/users/amaggiulli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amaggiulli/subscriptions","organizations_url":"https://api.github.com/users/amaggiulli/orgs","repos_url":"https://api.github.com/users/amaggiulli/repos","events_url":"https://api.github.com/users/amaggiulli/events{/privacy}","received_events_url":"https://api.github.com/users/amaggiulli/received_events","type":"User","site_admin":false},"repo":{"id":12299636,"name":"QLNet","full_name":"amaggiulli/QLNet","owner":{"login":"amaggiulli","id":5287576,"avatar_url":"https://avatars2.githubusercontent.com/u/5287576?v=4","gravatar_id":"","url":"https://api.github.com/users/amaggiulli","html_url":"https://github.com/amaggiulli","followers_url":"https://api.github.com/users/amaggiulli/followers","following_url":"https://api.github.com/users/amaggiulli/following{/other_user}","gists_url":"https://api.github.com/users/amaggiulli/gists{/gist_id}","starred_url":"https://api.github.com/users/amaggiulli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amaggiulli/subscriptions","organizations_url":"https://api.github.com/users/amaggiulli/orgs","repos_url":"https://api.github.com/users/amaggiulli/repos","events_url":"https://api.github.com/users/amaggiulli/events{/privacy}","received_events_url":"https://api.github.com/users/amaggiulli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amaggiulli/QLNet","description":"QLNet C# Library","fork":false,"url":"https://api.github.com/repos/amaggiulli/QLNet","forks_url":"https://api.github.com/repos/amaggiulli/QLNet/forks","keys_url":"https://api.github.com/repos/amaggiulli/QLNet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amaggiulli/QLNet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amaggiulli/QLNet/teams","hooks_url":"https://api.github.com/repos/amaggiulli/QLNet/hooks","issue_events_url":"https://api.github.com/repos/amaggiulli/QLNet/issues/events{/number}","events_url":"https://api.github.com/repos/amaggiulli/QLNet/events","assignees_url":"https://api.github.com/repos/amaggiulli/QLNet/assignees{/user}","branches_url":"https://api.github.com/repos/amaggiulli/QLNet/branches{/branch}","tags_url":"https://api.github.com/repos/amaggiulli/QLNet/tags","blobs_url":"https://api.github.com/repos/amaggiulli/QLNet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amaggiulli/QLNet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amaggiulli/QLNet/git/refs{/sha}","trees_url":"https://api.github.com/repos/amaggiulli/QLNet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amaggiulli/QLNet/statuses/{sha}","languages_url":"https://api.github.com/repos/amaggiulli/QLNet/languages","stargazers_url":"https://api.github.com/repos/amaggiulli/QLNet/stargazers","contributors_url":"https://api.github.com/repos/amaggiulli/QLNet/contributors","subscribers_url":"https://api.github.com/repos/amaggiulli/QLNet/subscribers","subscription_url":"https://api.github.com/repos/amaggiulli/QLNet/subscription","commits_url":"https://api.github.com/repos/amaggiulli/QLNet/commits{/sha}","git_commits_url":"https://api.github.com/repos/amaggiulli/QLNet/git/commits{/sha}","comments_url":"https://api.github.com/repos/amaggiulli/QLNet/comments{/number}","issue_comment_url":"https://api.github.com/repos/amaggiulli/QLNet/issues/comments{/number}","contents_url":"https://api.github.com/repos/amaggiulli/QLNet/contents/{+path}","compare_url":"https://api.github.com/repos/amaggiulli/QLNet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amaggiulli/QLNet/merges","archive_url":"https://api.github.com/repos/amaggiulli/QLNet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amaggiulli/QLNet/downloads","issues_url":"https://api.github.com/repos/amaggiulli/QLNet/issues{/number}","pulls_url":"https://api.github.com/repos/amaggiulli/QLNet/pulls{/number}","milestones_url":"https://api.github.com/repos/amaggiulli/QLNet/milestones{/number}","notifications_url":"https://api.github.com/repos/amaggiulli/QLNet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amaggiulli/QLNet/labels{/name}","releases_url":"https://api.github.com/repos/amaggiulli/QLNet/releases{/id}","deployments_url":"https://api.github.com/repos/amaggiulli/QLNet/deployments","created_at":"2013-08-22T14:51:43Z","updated_at":"2017-09-26T09:12:27Z","pushed_at":"2017-09-26T18:11:12Z","git_url":"git://github.com/amaggiulli/QLNet.git","ssh_url":"git@github.com:amaggiulli/QLNet.git","clone_url":"https://github.com/amaggiulli/QLNet.git","svn_url":"https://github.com/amaggiulli/QLNet","homepage":"","size":8351,"stargazers_count":134,"watchers_count":134,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":75,"mirror_url":null,"open_issues_count":7,"forks":75,"open_issues":7,"watchers":134,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/amaggiulli/QLNet/pulls/172"},"html":{"href":"https://github.com/amaggiulli/QLNet/pull/172"},"issue":{"href":"https://api.github.com/repos/amaggiulli/QLNet/issues/172"},"comments":{"href":"https://api.github.com/repos/amaggiulli/QLNet/issues/172/comments"},"review_comments":{"href":"https://api.github.com/repos/amaggiulli/QLNet/pulls/172/comments"},"review_comment":{"href":"https://api.github.com/repos/amaggiulli/QLNet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amaggiulli/QLNet/pulls/172/commits"},"statuses":{"href":"https://api.github.com/repos/amaggiulli/QLNet/statuses/0cb99dcc6e7df1b5a152a34431ca875816d12495"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"amaggiulli"}}