{"action":"created","comment":{"url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/comments/68790002","id":68790002,"diff_hunk":"@@ -28,69 +27,63 @@\n  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n  * POSSIBILITY OF SUCH DAMAGE.\n  *\n- * Authors: 2016 Pan Deng, Soumyajit De, Viktor Gal\n+ * Authors: 2016 Pan Deng, Soumyajit De, Heiko Strathmann, Viktor Gal\n  */\n \n #include <shogun/lib/config.h>\n-#include <shogun/io/SGIO.h>\n+#include <shogun/lib/common.h>\n #include <shogun/lib/SGVector.h>\n-#include <shogun/mathematics/linalg/BaseVector.h>\n+#include <shogun/io/SGIO.h>\n+#include <shogun/mathematics/linalg/GPUMemoryBase.h>\n #include <memory>\n \n-#ifndef GPU_Vector_H__\n-#define GPU_Vector_H__\n-\n-#ifdef HAVE_CXX11\n+#ifndef Linalg_Backend_Base_H__\n+#define Linalg_Backend_Base_H__\n \n namespace shogun\n {\n \n-/** GPU vector wrapper structure */\n-template <class T>\n-struct GPUVector : public BaseVector<T>\n+/** Base class for generic linalg methods */\n+class LinalgBackendBase\n {\n-\t/** Structure for different types of GPU vectors */\n-\tstruct GPUArray;\n-\n-\t/** Opaque pointer of GPUArray */\n-\tstd::unique_ptr<GPUArray> gpuarray;\n-\n-\t/** Default Constructor */\n-\tGPUVector();\n-\n-\t/** Wrap SGVector */\n-\tGPUVector(const SGVector<T> &vector);\n-\n-\t/** Copy Constructor*/\n-\tGPUVector(const GPUVector<T> &vector);\n+public:\n+\t/** Generic vector dot-product macro */\n+\t#define BACKEND_GENERIC_DOT(Type) \\\n+\tvirtual Type dot(const SGVector<Type>&, const SGVector<Type>&) const \\\n+\t{  \\\n+\t\tSG_SNOTIMPLEMENTED; \\\n+\t}\n \n-\t/** Empty destructor */\n-\t~GPUVector();\n+\tBACKEND_GENERIC_DOT(float32_t);\n+\tBACKEND_GENERIC_DOT(float64_t);\n+\tBACKEND_GENERIC_DOT(int32_t);\n \n-\t/** needs to be overridden to initialize empty data */\n-\tvoid init();\n+\t/** Generic transfer_to_gpu macro */\n+\t#define BACKEND_GENERIC_TO_GPU(Type) \\\n+\tvirtual GPUMemoryBase<Type>* to_gpu(const SGVector<Type>&) const \\\n+\t{  \\\n+\t\tSG_SNOTIMPLEMENTED; \\\n+\t}\n \n-\t/** Overload operator \"=\" */\n-\tGPUVector<T>& operator=(const GPUVector<T> &other);\n+\tBACKEND_GENERIC_TO_GPU(float32_t);\n+\tBACKEND_GENERIC_TO_GPU(float64_t);\n+\tBACKEND_GENERIC_TO_GPU(int32_t);\n \n-\t/** Data Storage */\n-\tinline bool onGPU()\n-\t{\n-\t\treturn true;\n+\t/** Generic transfer_from_gpu macro */\n+\t#define BACKEND_GENERIC_FROM_GPU(Type) \\\n+\tvirtual void from_gpu(const SGVector<Type>&, Type* data) const \\\n+\t{  \\\n+\t\tSG_SNOTIMPLEMENTED; \\\n \t}\n \n-public:\n-\t/** Vector length */\n-\tindex_t vlen;\n+\tBACKEND_GENERIC_FROM_GPU(float32_t);\n+\tBACKEND_GENERIC_FROM_GPU(float64_t);\n+\tBACKEND_GENERIC_FROM_GPU(int32_t);\n \n-\t/** Offset for the memory segment, i.e the data of the vector\n-\t * starts at vector+offset\n-\t */\n-\tindex_t offset;\n+\t/** needs to be overridden to return name */\n+\tvirtual const char* get_name() const = 0;","path":"src/shogun/mathematics/linalg/LinalgBackendBase.h","position":107,"original_position":107,"commit_id":"3fe1c52f6b9a857567453b4307bc86b1b0fd606a","original_commit_id":"3fe1c52f6b9a857567453b4307bc86b1b0fd606a","user":{"login":"karlnapf","id":699071,"avatar_url":"https://avatars.githubusercontent.com/u/699071?v=3","gravatar_id":"","url":"https://api.github.com/users/karlnapf","html_url":"https://github.com/karlnapf","followers_url":"https://api.github.com/users/karlnapf/followers","following_url":"https://api.github.com/users/karlnapf/following{/other_user}","gists_url":"https://api.github.com/users/karlnapf/gists{/gist_id}","starred_url":"https://api.github.com/users/karlnapf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karlnapf/subscriptions","organizations_url":"https://api.github.com/users/karlnapf/orgs","repos_url":"https://api.github.com/users/karlnapf/repos","events_url":"https://api.github.com/users/karlnapf/events{/privacy}","received_events_url":"https://api.github.com/users/karlnapf/received_events","type":"User","site_admin":false},"body":"maybe rather subclass CSGObject?","created_at":"2016-06-28T16:16:16Z","updated_at":"2016-06-28T16:16:16Z","html_url":"https://github.com/shogun-toolbox/shogun/pull/3317#discussion_r68790002","pull_request_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/3317","_links":{"self":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/comments/68790002"},"html":{"href":"https://github.com/shogun-toolbox/shogun/pull/3317#discussion_r68790002"},"pull_request":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/3317"}}},"pull_request":{"url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/3317","id":75416189,"html_url":"https://github.com/shogun-toolbox/shogun/pull/3317","diff_url":"https://github.com/shogun-toolbox/shogun/pull/3317.diff","patch_url":"https://github.com/shogun-toolbox/shogun/pull/3317.patch","issue_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues/3317","number":3317,"state":"open","locked":false,"title":"Linalg refactor","user":{"login":"OXPHOS","id":8815664,"avatar_url":"https://avatars.githubusercontent.com/u/8815664?v=3","gravatar_id":"","url":"https://api.github.com/users/OXPHOS","html_url":"https://github.com/OXPHOS","followers_url":"https://api.github.com/users/OXPHOS/followers","following_url":"https://api.github.com/users/OXPHOS/following{/other_user}","gists_url":"https://api.github.com/users/OXPHOS/gists{/gist_id}","starred_url":"https://api.github.com/users/OXPHOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OXPHOS/subscriptions","organizations_url":"https://api.github.com/users/OXPHOS/orgs","repos_url":"https://api.github.com/users/OXPHOS/repos","events_url":"https://api.github.com/users/OXPHOS/events{/privacy}","received_events_url":"https://api.github.com/users/OXPHOS/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-28T04:16:53Z","updated_at":"2016-06-28T16:16:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9bc03d0c4c0d7c7e3523cfe920bbd1279a30c47","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/3317/commits","review_comments_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/3317/comments","review_comment_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues/3317/comments","statuses_url":"https://api.github.com/repos/shogun-toolbox/shogun/statuses/3fe1c52f6b9a857567453b4307bc86b1b0fd606a","head":{"label":"OXPHOS:linalg_refactor_2","ref":"linalg_refactor_2","sha":"3fe1c52f6b9a857567453b4307bc86b1b0fd606a","user":{"login":"OXPHOS","id":8815664,"avatar_url":"https://avatars.githubusercontent.com/u/8815664?v=3","gravatar_id":"","url":"https://api.github.com/users/OXPHOS","html_url":"https://github.com/OXPHOS","followers_url":"https://api.github.com/users/OXPHOS/followers","following_url":"https://api.github.com/users/OXPHOS/following{/other_user}","gists_url":"https://api.github.com/users/OXPHOS/gists{/gist_id}","starred_url":"https://api.github.com/users/OXPHOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OXPHOS/subscriptions","organizations_url":"https://api.github.com/users/OXPHOS/orgs","repos_url":"https://api.github.com/users/OXPHOS/repos","events_url":"https://api.github.com/users/OXPHOS/events{/privacy}","received_events_url":"https://api.github.com/users/OXPHOS/received_events","type":"User","site_admin":false},"repo":{"id":54068145,"name":"shogun","full_name":"OXPHOS/shogun","owner":{"login":"OXPHOS","id":8815664,"avatar_url":"https://avatars.githubusercontent.com/u/8815664?v=3","gravatar_id":"","url":"https://api.github.com/users/OXPHOS","html_url":"https://github.com/OXPHOS","followers_url":"https://api.github.com/users/OXPHOS/followers","following_url":"https://api.github.com/users/OXPHOS/following{/other_user}","gists_url":"https://api.github.com/users/OXPHOS/gists{/gist_id}","starred_url":"https://api.github.com/users/OXPHOS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OXPHOS/subscriptions","organizations_url":"https://api.github.com/users/OXPHOS/orgs","repos_url":"https://api.github.com/users/OXPHOS/repos","events_url":"https://api.github.com/users/OXPHOS/events{/privacy}","received_events_url":"https://api.github.com/users/OXPHOS/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OXPHOS/shogun","description":"The Shogun Machine Learning Toolbox (Source Code)","fork":true,"url":"https://api.github.com/repos/OXPHOS/shogun","forks_url":"https://api.github.com/repos/OXPHOS/shogun/forks","keys_url":"https://api.github.com/repos/OXPHOS/shogun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OXPHOS/shogun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OXPHOS/shogun/teams","hooks_url":"https://api.github.com/repos/OXPHOS/shogun/hooks","issue_events_url":"https://api.github.com/repos/OXPHOS/shogun/issues/events{/number}","events_url":"https://api.github.com/repos/OXPHOS/shogun/events","assignees_url":"https://api.github.com/repos/OXPHOS/shogun/assignees{/user}","branches_url":"https://api.github.com/repos/OXPHOS/shogun/branches{/branch}","tags_url":"https://api.github.com/repos/OXPHOS/shogun/tags","blobs_url":"https://api.github.com/repos/OXPHOS/shogun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OXPHOS/shogun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OXPHOS/shogun/git/refs{/sha}","trees_url":"https://api.github.com/repos/OXPHOS/shogun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OXPHOS/shogun/statuses/{sha}","languages_url":"https://api.github.com/repos/OXPHOS/shogun/languages","stargazers_url":"https://api.github.com/repos/OXPHOS/shogun/stargazers","contributors_url":"https://api.github.com/repos/OXPHOS/shogun/contributors","subscribers_url":"https://api.github.com/repos/OXPHOS/shogun/subscribers","subscription_url":"https://api.github.com/repos/OXPHOS/shogun/subscription","commits_url":"https://api.github.com/repos/OXPHOS/shogun/commits{/sha}","git_commits_url":"https://api.github.com/repos/OXPHOS/shogun/git/commits{/sha}","comments_url":"https://api.github.com/repos/OXPHOS/shogun/comments{/number}","issue_comment_url":"https://api.github.com/repos/OXPHOS/shogun/issues/comments{/number}","contents_url":"https://api.github.com/repos/OXPHOS/shogun/contents/{+path}","compare_url":"https://api.github.com/repos/OXPHOS/shogun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OXPHOS/shogun/merges","archive_url":"https://api.github.com/repos/OXPHOS/shogun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OXPHOS/shogun/downloads","issues_url":"https://api.github.com/repos/OXPHOS/shogun/issues{/number}","pulls_url":"https://api.github.com/repos/OXPHOS/shogun/pulls{/number}","milestones_url":"https://api.github.com/repos/OXPHOS/shogun/milestones{/number}","notifications_url":"https://api.github.com/repos/OXPHOS/shogun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OXPHOS/shogun/labels{/name}","releases_url":"https://api.github.com/repos/OXPHOS/shogun/releases{/id}","deployments_url":"https://api.github.com/repos/OXPHOS/shogun/deployments","created_at":"2016-03-16T21:34:50Z","updated_at":"2016-03-16T21:34:58Z","pushed_at":"2016-06-28T14:19:37Z","git_url":"git://github.com/OXPHOS/shogun.git","ssh_url":"git@github.com:OXPHOS/shogun.git","clone_url":"https://github.com/OXPHOS/shogun.git","svn_url":"https://github.com/OXPHOS/shogun","homepage":"http://www.shogun-toolbox.org","size":60347,"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":"develop"}},"base":{"label":"shogun-toolbox:feature/linalg_refactor","ref":"feature/linalg_refactor","sha":"254a83f05b332bf2998b18b73d8b02e4a147fa5a","user":{"login":"shogun-toolbox","id":690673,"avatar_url":"https://avatars.githubusercontent.com/u/690673?v=3","gravatar_id":"","url":"https://api.github.com/users/shogun-toolbox","html_url":"https://github.com/shogun-toolbox","followers_url":"https://api.github.com/users/shogun-toolbox/followers","following_url":"https://api.github.com/users/shogun-toolbox/following{/other_user}","gists_url":"https://api.github.com/users/shogun-toolbox/gists{/gist_id}","starred_url":"https://api.github.com/users/shogun-toolbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shogun-toolbox/subscriptions","organizations_url":"https://api.github.com/users/shogun-toolbox/orgs","repos_url":"https://api.github.com/users/shogun-toolbox/repos","events_url":"https://api.github.com/users/shogun-toolbox/events{/privacy}","received_events_url":"https://api.github.com/users/shogun-toolbox/received_events","type":"Organization","site_admin":false},"repo":{"id":1555094,"name":"shogun","full_name":"shogun-toolbox/shogun","owner":{"login":"shogun-toolbox","id":690673,"avatar_url":"https://avatars.githubusercontent.com/u/690673?v=3","gravatar_id":"","url":"https://api.github.com/users/shogun-toolbox","html_url":"https://github.com/shogun-toolbox","followers_url":"https://api.github.com/users/shogun-toolbox/followers","following_url":"https://api.github.com/users/shogun-toolbox/following{/other_user}","gists_url":"https://api.github.com/users/shogun-toolbox/gists{/gist_id}","starred_url":"https://api.github.com/users/shogun-toolbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shogun-toolbox/subscriptions","organizations_url":"https://api.github.com/users/shogun-toolbox/orgs","repos_url":"https://api.github.com/users/shogun-toolbox/repos","events_url":"https://api.github.com/users/shogun-toolbox/events{/privacy}","received_events_url":"https://api.github.com/users/shogun-toolbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shogun-toolbox/shogun","description":"The Shogun Machine Learning Toolbox (Source Code)","fork":false,"url":"https://api.github.com/repos/shogun-toolbox/shogun","forks_url":"https://api.github.com/repos/shogun-toolbox/shogun/forks","keys_url":"https://api.github.com/repos/shogun-toolbox/shogun/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shogun-toolbox/shogun/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shogun-toolbox/shogun/teams","hooks_url":"https://api.github.com/repos/shogun-toolbox/shogun/hooks","issue_events_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues/events{/number}","events_url":"https://api.github.com/repos/shogun-toolbox/shogun/events","assignees_url":"https://api.github.com/repos/shogun-toolbox/shogun/assignees{/user}","branches_url":"https://api.github.com/repos/shogun-toolbox/shogun/branches{/branch}","tags_url":"https://api.github.com/repos/shogun-toolbox/shogun/tags","blobs_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/refs{/sha}","trees_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shogun-toolbox/shogun/statuses/{sha}","languages_url":"https://api.github.com/repos/shogun-toolbox/shogun/languages","stargazers_url":"https://api.github.com/repos/shogun-toolbox/shogun/stargazers","contributors_url":"https://api.github.com/repos/shogun-toolbox/shogun/contributors","subscribers_url":"https://api.github.com/repos/shogun-toolbox/shogun/subscribers","subscription_url":"https://api.github.com/repos/shogun-toolbox/shogun/subscription","commits_url":"https://api.github.com/repos/shogun-toolbox/shogun/commits{/sha}","git_commits_url":"https://api.github.com/repos/shogun-toolbox/shogun/git/commits{/sha}","comments_url":"https://api.github.com/repos/shogun-toolbox/shogun/comments{/number}","issue_comment_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues/comments{/number}","contents_url":"https://api.github.com/repos/shogun-toolbox/shogun/contents/{+path}","compare_url":"https://api.github.com/repos/shogun-toolbox/shogun/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shogun-toolbox/shogun/merges","archive_url":"https://api.github.com/repos/shogun-toolbox/shogun/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shogun-toolbox/shogun/downloads","issues_url":"https://api.github.com/repos/shogun-toolbox/shogun/issues{/number}","pulls_url":"https://api.github.com/repos/shogun-toolbox/shogun/pulls{/number}","milestones_url":"https://api.github.com/repos/shogun-toolbox/shogun/milestones{/number}","notifications_url":"https://api.github.com/repos/shogun-toolbox/shogun/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shogun-toolbox/shogun/labels{/name}","releases_url":"https://api.github.com/repos/shogun-toolbox/shogun/releases{/id}","deployments_url":"https://api.github.com/repos/shogun-toolbox/shogun/deployments","created_at":"2011-04-01T10:44:32Z","updated_at":"2016-06-28T07:51:05Z","pushed_at":"2016-06-28T16:00:31Z","git_url":"git://github.com/shogun-toolbox/shogun.git","ssh_url":"git@github.com:shogun-toolbox/shogun.git","clone_url":"https://github.com/shogun-toolbox/shogun.git","svn_url":"https://github.com/shogun-toolbox/shogun","homepage":"http://www.shogun-toolbox.org","size":193409,"stargazers_count":1090,"watchers_count":1090,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":587,"mirror_url":null,"open_issues_count":437,"forks":587,"open_issues":437,"watchers":1090,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/3317"},"html":{"href":"https://github.com/shogun-toolbox/shogun/pull/3317"},"issue":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/issues/3317"},"comments":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/issues/3317/comments"},"review_comments":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/3317/comments"},"review_comment":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/pulls/3317/commits"},"statuses":{"href":"https://api.github.com/repos/shogun-toolbox/shogun/statuses/3fe1c52f6b9a857567453b4307bc86b1b0fd606a"}}}}
{"actor":{"display_login":"karlnapf"}}