{"action":"created","issue":{"url":"https://api.github.com/repos/numba/numba/issues/1359","labels_url":"https://api.github.com/repos/numba/numba/issues/1359/labels{/name}","comments_url":"https://api.github.com/repos/numba/numba/issues/1359/comments","events_url":"https://api.github.com/repos/numba/numba/issues/1359/events","html_url":"https://github.com/numba/numba/issues/1359","id":100586607,"number":1359,"title":"Adding numpy functions myself","user":{"login":"jsphon","id":5187727,"avatar_url":"https://avatars.githubusercontent.com/u/5187727?v=3","gravatar_id":"","url":"https://api.github.com/users/jsphon","html_url":"https://github.com/jsphon","followers_url":"https://api.github.com/users/jsphon/followers","following_url":"https://api.github.com/users/jsphon/following{/other_user}","gists_url":"https://api.github.com/users/jsphon/gists{/gist_id}","starred_url":"https://api.github.com/users/jsphon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsphon/subscriptions","organizations_url":"https://api.github.com/users/jsphon/orgs","repos_url":"https://api.github.com/users/jsphon/repos","events_url":"https://api.github.com/users/jsphon/events{/privacy}","received_events_url":"https://api.github.com/users/jsphon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-12T16:51:45Z","updated_at":"2015-08-16T15:00:42Z","closed_at":null,"body":"If I wanted to try contributing to numba by making np.unique compatible with nopython mode, where would I begin? Is there any docunentation to help me get started?"},"comment":{"url":"https://api.github.com/repos/numba/numba/issues/comments/131569790","html_url":"https://github.com/numba/numba/issues/1359#issuecomment-131569790","issue_url":"https://api.github.com/repos/numba/numba/issues/1359","id":131569790,"user":{"login":"jsphon","id":5187727,"avatar_url":"https://avatars.githubusercontent.com/u/5187727?v=3","gravatar_id":"","url":"https://api.github.com/users/jsphon","html_url":"https://github.com/jsphon","followers_url":"https://api.github.com/users/jsphon/followers","following_url":"https://api.github.com/users/jsphon/following{/other_user}","gists_url":"https://api.github.com/users/jsphon/gists{/gist_id}","starred_url":"https://api.github.com/users/jsphon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsphon/subscriptions","organizations_url":"https://api.github.com/users/jsphon/orgs","repos_url":"https://api.github.com/users/jsphon/repos","events_url":"https://api.github.com/users/jsphon/events{/privacy}","received_events_url":"https://api.github.com/users/jsphon/received_events","type":"User","site_admin":false},"created_at":"2015-08-16T15:00:42Z","updated_at":"2015-08-16T15:00:42Z","body":"I have been playing around with the ret function from my previous post:\r\n\r\n    @nb.jit( nopython=True )\r\n    def ret( x, y=True ):\r\n        z = np.empty(0, np.bool_)\r\n        r =(z,)\r\n        \r\n        if y:\r\n            r = ( x, z )\r\n        else:\r\n            r = ( x, )\r\n    \r\n        return r\r\n\r\nWhen I compile that I get:\r\n\r\n\t======================================================================\r\n\tERROR: test_ret (numerical_functions.tests.numba_funcs.setops_tests.Test)\r\n\t----------------------------------------------------------------------\r\n\tTraceback (most recent call last):\r\n\t  File \"/home/jon/Documents/LiClipseWorkspace/NumericalFunctions/numerical_functions/tests/numba_funcs/setops_tests.py\", line 19, in test_ret\r\n\t    r = mod.ret(x)\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/dispatcher.py\", line 159, in _compile_for_args\r\n\t    return self.compile(sig)\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/dispatcher.py\", line 322, in compile\r\n\t    flags=flags, locals=self.locals)\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/compiler.py\", line 594, in compile_extra\r\n\t    return pipeline.compile_extra(func)\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/compiler.py\", line 317, in compile_extra\r\n\t    return self.compile_bytecode(bc, func_attr=self.func_attr)\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/compiler.py\", line 326, in compile_bytecode\r\n\t    return self._compile_bytecode()\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/compiler.py\", line 581, in _compile_bytecode\r\n\t    return pm.run(self.status)\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/compiler.py\", line 209, in run\r\n\t    raise patched_exception\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/compiler.py\", line 201, in run\r\n\t    res = stage()\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/compiler.py\", line 414, in stage_nopython_frontend\r\n\t    self.locals)\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/compiler.py\", line 710, in type_inference_stage\r\n\t    typemap, restype, calltypes = infer.unify()\r\n\t  File \"/home/jon/anaconda/envs/py33/lib/python3.3/site-packages/numba/typeinfer.py\", line 414, in unify\r\n\t    raise TypingError(\"Can't unify types of variable '%s': %s\" % (var, tv))\r\n\tnumba.errors.TypingError: Failed at nopython (nopython frontend)\r\n\tCan't unify types of variable '$60.2': $60.2 := {(array(bool, 1d, C) x 1), (array(int64, 1d, C), array(bool, 1d, C)), (array(int64, 1d, C) x 1)}\r\n\r\nDoes that error message mean that nopython numba functions must have the same number of output values?\r\n\r\nIf that is the case, what would be the recommended way of implementing np.unique, which can return 1, 2, 3 or 4 arrays, depending on the input parameters. My use case requires 2 arrays to be returned (the unique values plus the unique inverses)."}}