{"action":"created","comment":{"url":"https://api.github.com/repos/arrayfire/arrayfire/pulls/comments/73547232","id":73547232,"diff_hunk":"@@ -78,19 +78,30 @@ af_err af_det(double *real_val, double *imag_val, const af_array in)\n \n         cfloat cfval;\n         cdouble cdval;\n+        bool empty = i_info.dims()[0] == 0;\n \n         switch(type) {\n-        case f32: *real_val = det<float  >(in);  break;\n-        case f64: *real_val = det<double >(in);  break;\n+        case f32: *real_val = (empty)? 1.f : det<float  >(in);  break;","path":"src/api/c/det.cpp","position":9,"original_position":9,"commit_id":"15788c33e6700bc70a32fbd3e1cfbbba8194b891","original_commit_id":"15788c33e6700bc70a32fbd3e1cfbbba8194b891","user":{"login":"pavanky","id":364829,"avatar_url":"https://avatars.githubusercontent.com/u/364829?v=3","gravatar_id":"","url":"https://api.github.com/users/pavanky","html_url":"https://github.com/pavanky","followers_url":"https://api.github.com/users/pavanky/followers","following_url":"https://api.github.com/users/pavanky/following{/other_user}","gists_url":"https://api.github.com/users/pavanky/gists{/gist_id}","starred_url":"https://api.github.com/users/pavanky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavanky/subscriptions","organizations_url":"https://api.github.com/users/pavanky/orgs","repos_url":"https://api.github.com/users/pavanky/repos","events_url":"https://api.github.com/users/pavanky/events{/privacy}","received_events_url":"https://api.github.com/users/pavanky/received_events","type":"User","site_admin":false},"body":"Perhaps do the checks in the wrapper function. That way you can return scalar<T>(1.0); once and not worry about multiple if/elese statements?","created_at":"2016-08-04T15:40:29Z","updated_at":"2016-08-04T15:40:29Z","html_url":"https://github.com/arrayfire/arrayfire/pull/1533#discussion_r73547232","pull_request_url":"https://api.github.com/repos/arrayfire/arrayfire/pulls/1533","_links":{"self":{"href":"https://api.github.com/repos/arrayfire/arrayfire/pulls/comments/73547232"},"html":{"href":"https://github.com/arrayfire/arrayfire/pull/1533#discussion_r73547232"},"pull_request":{"href":"https://api.github.com/repos/arrayfire/arrayfire/pulls/1533"}}},"pull_request":{"url":"https://api.github.com/repos/arrayfire/arrayfire/pulls/1533","id":80098894,"html_url":"https://github.com/arrayfire/arrayfire/pull/1533","diff_url":"https://github.com/arrayfire/arrayfire/pull/1533.diff","patch_url":"https://github.com/arrayfire/arrayfire/pull/1533.patch","issue_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/1533","number":1533,"state":"open","locked":false,"title":"Handle empty arrays in a variety of functions","user":{"login":"syurkevi","id":4434164,"avatar_url":"https://avatars.githubusercontent.com/u/4434164?v=3","gravatar_id":"","url":"https://api.github.com/users/syurkevi","html_url":"https://github.com/syurkevi","followers_url":"https://api.github.com/users/syurkevi/followers","following_url":"https://api.github.com/users/syurkevi/following{/other_user}","gists_url":"https://api.github.com/users/syurkevi/gists{/gist_id}","starred_url":"https://api.github.com/users/syurkevi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syurkevi/subscriptions","organizations_url":"https://api.github.com/users/syurkevi/orgs","repos_url":"https://api.github.com/users/syurkevi/repos","events_url":"https://api.github.com/users/syurkevi/events{/privacy}","received_events_url":"https://api.github.com/users/syurkevi/received_events","type":"User","site_admin":false},"body":"Allows indexing with empty arrays . Also handles weird cases such as `af::det( [ ] ) = 1` ","created_at":"2016-08-04T15:28:12Z","updated_at":"2016-08-04T15:40:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d7c230d24d16e98fb9a7f85abc28ddfd9bfb038b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/arrayfire/arrayfire/pulls/1533/commits","review_comments_url":"https://api.github.com/repos/arrayfire/arrayfire/pulls/1533/comments","review_comment_url":"https://api.github.com/repos/arrayfire/arrayfire/pulls/comments{/number}","comments_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/1533/comments","statuses_url":"https://api.github.com/repos/arrayfire/arrayfire/statuses/15788c33e6700bc70a32fbd3e1cfbbba8194b891","head":{"label":"syurkevi:zero_len","ref":"zero_len","sha":"15788c33e6700bc70a32fbd3e1cfbbba8194b891","user":{"login":"syurkevi","id":4434164,"avatar_url":"https://avatars.githubusercontent.com/u/4434164?v=3","gravatar_id":"","url":"https://api.github.com/users/syurkevi","html_url":"https://github.com/syurkevi","followers_url":"https://api.github.com/users/syurkevi/followers","following_url":"https://api.github.com/users/syurkevi/following{/other_user}","gists_url":"https://api.github.com/users/syurkevi/gists{/gist_id}","starred_url":"https://api.github.com/users/syurkevi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syurkevi/subscriptions","organizations_url":"https://api.github.com/users/syurkevi/orgs","repos_url":"https://api.github.com/users/syurkevi/repos","events_url":"https://api.github.com/users/syurkevi/events{/privacy}","received_events_url":"https://api.github.com/users/syurkevi/received_events","type":"User","site_admin":false},"repo":{"id":28361843,"name":"arrayfire","full_name":"syurkevi/arrayfire","owner":{"login":"syurkevi","id":4434164,"avatar_url":"https://avatars.githubusercontent.com/u/4434164?v=3","gravatar_id":"","url":"https://api.github.com/users/syurkevi","html_url":"https://github.com/syurkevi","followers_url":"https://api.github.com/users/syurkevi/followers","following_url":"https://api.github.com/users/syurkevi/following{/other_user}","gists_url":"https://api.github.com/users/syurkevi/gists{/gist_id}","starred_url":"https://api.github.com/users/syurkevi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syurkevi/subscriptions","organizations_url":"https://api.github.com/users/syurkevi/orgs","repos_url":"https://api.github.com/users/syurkevi/repos","events_url":"https://api.github.com/users/syurkevi/events{/privacy}","received_events_url":"https://api.github.com/users/syurkevi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/syurkevi/arrayfire","description":"ArrayFire: a general purpose GPU library.","fork":true,"url":"https://api.github.com/repos/syurkevi/arrayfire","forks_url":"https://api.github.com/repos/syurkevi/arrayfire/forks","keys_url":"https://api.github.com/repos/syurkevi/arrayfire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/syurkevi/arrayfire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/syurkevi/arrayfire/teams","hooks_url":"https://api.github.com/repos/syurkevi/arrayfire/hooks","issue_events_url":"https://api.github.com/repos/syurkevi/arrayfire/issues/events{/number}","events_url":"https://api.github.com/repos/syurkevi/arrayfire/events","assignees_url":"https://api.github.com/repos/syurkevi/arrayfire/assignees{/user}","branches_url":"https://api.github.com/repos/syurkevi/arrayfire/branches{/branch}","tags_url":"https://api.github.com/repos/syurkevi/arrayfire/tags","blobs_url":"https://api.github.com/repos/syurkevi/arrayfire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/syurkevi/arrayfire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/syurkevi/arrayfire/git/refs{/sha}","trees_url":"https://api.github.com/repos/syurkevi/arrayfire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/syurkevi/arrayfire/statuses/{sha}","languages_url":"https://api.github.com/repos/syurkevi/arrayfire/languages","stargazers_url":"https://api.github.com/repos/syurkevi/arrayfire/stargazers","contributors_url":"https://api.github.com/repos/syurkevi/arrayfire/contributors","subscribers_url":"https://api.github.com/repos/syurkevi/arrayfire/subscribers","subscription_url":"https://api.github.com/repos/syurkevi/arrayfire/subscription","commits_url":"https://api.github.com/repos/syurkevi/arrayfire/commits{/sha}","git_commits_url":"https://api.github.com/repos/syurkevi/arrayfire/git/commits{/sha}","comments_url":"https://api.github.com/repos/syurkevi/arrayfire/comments{/number}","issue_comment_url":"https://api.github.com/repos/syurkevi/arrayfire/issues/comments{/number}","contents_url":"https://api.github.com/repos/syurkevi/arrayfire/contents/{+path}","compare_url":"https://api.github.com/repos/syurkevi/arrayfire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/syurkevi/arrayfire/merges","archive_url":"https://api.github.com/repos/syurkevi/arrayfire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/syurkevi/arrayfire/downloads","issues_url":"https://api.github.com/repos/syurkevi/arrayfire/issues{/number}","pulls_url":"https://api.github.com/repos/syurkevi/arrayfire/pulls{/number}","milestones_url":"https://api.github.com/repos/syurkevi/arrayfire/milestones{/number}","notifications_url":"https://api.github.com/repos/syurkevi/arrayfire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/syurkevi/arrayfire/labels{/name}","releases_url":"https://api.github.com/repos/syurkevi/arrayfire/releases{/id}","deployments_url":"https://api.github.com/repos/syurkevi/arrayfire/deployments","created_at":"2014-12-22T22:07:13Z","updated_at":"2014-12-22T22:07:14Z","pushed_at":"2016-08-04T15:22:20Z","git_url":"git://github.com/syurkevi/arrayfire.git","ssh_url":"git@github.com:syurkevi/arrayfire.git","clone_url":"https://github.com/syurkevi/arrayfire.git","svn_url":"https://github.com/syurkevi/arrayfire","homepage":"http://arrayfire.com","size":8777,"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":"devel"}},"base":{"label":"arrayfire:devel","ref":"devel","sha":"71da292bc42e29639443b6873a5de364fa7a45b9","user":{"login":"arrayfire","id":5395442,"avatar_url":"https://avatars.githubusercontent.com/u/5395442?v=3","gravatar_id":"","url":"https://api.github.com/users/arrayfire","html_url":"https://github.com/arrayfire","followers_url":"https://api.github.com/users/arrayfire/followers","following_url":"https://api.github.com/users/arrayfire/following{/other_user}","gists_url":"https://api.github.com/users/arrayfire/gists{/gist_id}","starred_url":"https://api.github.com/users/arrayfire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arrayfire/subscriptions","organizations_url":"https://api.github.com/users/arrayfire/orgs","repos_url":"https://api.github.com/users/arrayfire/repos","events_url":"https://api.github.com/users/arrayfire/events{/privacy}","received_events_url":"https://api.github.com/users/arrayfire/received_events","type":"Organization","site_admin":false},"repo":{"id":25889802,"name":"arrayfire","full_name":"arrayfire/arrayfire","owner":{"login":"arrayfire","id":5395442,"avatar_url":"https://avatars.githubusercontent.com/u/5395442?v=3","gravatar_id":"","url":"https://api.github.com/users/arrayfire","html_url":"https://github.com/arrayfire","followers_url":"https://api.github.com/users/arrayfire/followers","following_url":"https://api.github.com/users/arrayfire/following{/other_user}","gists_url":"https://api.github.com/users/arrayfire/gists{/gist_id}","starred_url":"https://api.github.com/users/arrayfire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arrayfire/subscriptions","organizations_url":"https://api.github.com/users/arrayfire/orgs","repos_url":"https://api.github.com/users/arrayfire/repos","events_url":"https://api.github.com/users/arrayfire/events{/privacy}","received_events_url":"https://api.github.com/users/arrayfire/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/arrayfire/arrayfire","description":"ArrayFire: a general purpose GPU library.","fork":false,"url":"https://api.github.com/repos/arrayfire/arrayfire","forks_url":"https://api.github.com/repos/arrayfire/arrayfire/forks","keys_url":"https://api.github.com/repos/arrayfire/arrayfire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arrayfire/arrayfire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arrayfire/arrayfire/teams","hooks_url":"https://api.github.com/repos/arrayfire/arrayfire/hooks","issue_events_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/events{/number}","events_url":"https://api.github.com/repos/arrayfire/arrayfire/events","assignees_url":"https://api.github.com/repos/arrayfire/arrayfire/assignees{/user}","branches_url":"https://api.github.com/repos/arrayfire/arrayfire/branches{/branch}","tags_url":"https://api.github.com/repos/arrayfire/arrayfire/tags","blobs_url":"https://api.github.com/repos/arrayfire/arrayfire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arrayfire/arrayfire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arrayfire/arrayfire/git/refs{/sha}","trees_url":"https://api.github.com/repos/arrayfire/arrayfire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arrayfire/arrayfire/statuses/{sha}","languages_url":"https://api.github.com/repos/arrayfire/arrayfire/languages","stargazers_url":"https://api.github.com/repos/arrayfire/arrayfire/stargazers","contributors_url":"https://api.github.com/repos/arrayfire/arrayfire/contributors","subscribers_url":"https://api.github.com/repos/arrayfire/arrayfire/subscribers","subscription_url":"https://api.github.com/repos/arrayfire/arrayfire/subscription","commits_url":"https://api.github.com/repos/arrayfire/arrayfire/commits{/sha}","git_commits_url":"https://api.github.com/repos/arrayfire/arrayfire/git/commits{/sha}","comments_url":"https://api.github.com/repos/arrayfire/arrayfire/comments{/number}","issue_comment_url":"https://api.github.com/repos/arrayfire/arrayfire/issues/comments{/number}","contents_url":"https://api.github.com/repos/arrayfire/arrayfire/contents/{+path}","compare_url":"https://api.github.com/repos/arrayfire/arrayfire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arrayfire/arrayfire/merges","archive_url":"https://api.github.com/repos/arrayfire/arrayfire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arrayfire/arrayfire/downloads","issues_url":"https://api.github.com/repos/arrayfire/arrayfire/issues{/number}","pulls_url":"https://api.github.com/repos/arrayfire/arrayfire/pulls{/number}","milestones_url":"https://api.github.com/repos/arrayfire/arrayfire/milestones{/number}","notifications_url":"https://api.github.com/repos/arrayfire/arrayfire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arrayfire/arrayfire/labels{/name}","releases_url":"https://api.github.com/repos/arrayfire/arrayfire/releases{/id}","deployments_url":"https://api.github.com/repos/arrayfire/arrayfire/deployments","created_at":"2014-10-28T20:58:33Z","updated_at":"2016-08-04T03:09:11Z","pushed_at":"2016-08-04T15:28:12Z","git_url":"git://github.com/arrayfire/arrayfire.git","ssh_url":"git@github.com:arrayfire/arrayfire.git","clone_url":"https://github.com/arrayfire/arrayfire.git","svn_url":"https://github.com/arrayfire/arrayfire","homepage":"https://arrayfire.com","size":12973,"stargazers_count":1402,"watchers_count":1402,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":210,"mirror_url":null,"open_issues_count":149,"forks":210,"open_issues":149,"watchers":1402,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/arrayfire/arrayfire/pulls/1533"},"html":{"href":"https://github.com/arrayfire/arrayfire/pull/1533"},"issue":{"href":"https://api.github.com/repos/arrayfire/arrayfire/issues/1533"},"comments":{"href":"https://api.github.com/repos/arrayfire/arrayfire/issues/1533/comments"},"review_comments":{"href":"https://api.github.com/repos/arrayfire/arrayfire/pulls/1533/comments"},"review_comment":{"href":"https://api.github.com/repos/arrayfire/arrayfire/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/arrayfire/arrayfire/pulls/1533/commits"},"statuses":{"href":"https://api.github.com/repos/arrayfire/arrayfire/statuses/15788c33e6700bc70a32fbd3e1cfbbba8194b891"}}}}
{"actor":{"display_login":"pavanky"}}