{"action":"created","comment":{"url":"https://api.github.com/repos/cmssnu/dolphin/pulls/comments/45179517","id":45179517,"diff_hunk":"@@ -0,0 +1,148 @@\n+/*\n+ * Copyright (C) 2015 Seoul National University\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *         http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package edu.snu.dolphin.dnn.blas;\n+\n+/**\n+ * Factory interface for {@link Matrix}.\n+ */\n+public interface MatrixFactory {\n+\n+  /**\n+   * Creates a row vector.\n+   * @param length the length of a row vector\n+   * @return a generated row vector\n+   */\n+  Matrix create(final int length);\n+\n+  /**\n+   * Creates a matrix.\n+   * @param rows the number of rows\n+   * @param columns the number of columns\n+   * @return a generated matrix\n+   */\n+  Matrix create(final int rows, final int columns);\n+\n+  /**\n+   * Creates a row vector with the given values.\n+   * @param data elements of a row vector\n+   * @return a generated row vector\n+   */\n+  Matrix create(final float[] data);\n+\n+  /**\n+   * Creates a matrix with the given values.\n+   * @param data elements of a matrix\n+   * @return a generated matrix\n+   */\n+  Matrix create(final float[][] data);\n+\n+  /**\n+   * Creates a matrix with the given values.\n+   * @param data elements of a matrix in column-major order\n+   * @param rows the number of rows\n+   * @param columns the number of columns\n+   * @return a generated matrix\n+   */\n+  Matrix create(final float[] data, final int rows, final int columns);\n+\n+  /**\n+   * Creates a row vector in which all elements are equal to {@code 1}.\n+   * @param length the length of a row vector\n+   * @return a generated row vector\n+   */\n+  Matrix ones(final int length);\n+\n+  /**\n+   * Creates a matrix in which all elements are equal to {@code 1}.\n+   * @param rows the number of rows\n+   * @param columns the number of columns\n+   * @return a generated matrix\n+   */\n+  Matrix ones(final int rows, final int columns);\n+\n+  /**\n+   * Creates a row vector in which all elements are equal to {@code 0}.\n+   * @param length the length of a row vector\n+   * @return a generated row vector\n+   */\n+  Matrix zeros(final int length);\n+\n+  /**\n+   * Creates a matrix in which all elements are equal to {@code 0}.\n+   * @param rows the number of rows\n+   * @param columns the number of columns\n+   * @return a generated matrix\n+   */\n+  Matrix zeros(final int rows, final int columns);\n+\n+  /**\n+   * Creates a row vector with random values uniformly distributed in 0..1.\n+   * @param length the length of a row vector\n+   * @return a generated row vector\n+   */\n+  Matrix rand(final int length);\n+\n+  /**\n+   * Creates a matrix with random values uniformly distributed in 0..1.\n+   * @param rows the number of rows\n+   * @param columns the number of columns\n+   * @return a generated matrix\n+   */\n+  Matrix rand(final int rows, final int columns);\n+\n+  /**\n+   * Creates a matrix with random values uniformly distributed in 0..1.\n+   * @param rows the number of rows\n+   * @param columns the number of columns\n+   * @param seed a random seed\n+   * @return a generated matrix\n+   */\n+  Matrix rand(final int rows, final int columns, long seed);\n+\n+  /**\n+   * Creates a row vector with normally distributed random values.","path":"dolphin-dnn/src/main/java/edu/snu/dolphin/dnn/blas/MatrixFactory.java","position":116,"original_position":116,"commit_id":"d0bdbaff3e5ef4c45db6ab14144aeedc44f5a49f","original_commit_id":"d0bdbaff3e5ef4c45db6ab14144aeedc44f5a49f","user":{"login":"jsjason","id":5705789,"avatar_url":"https://avatars.githubusercontent.com/u/5705789?v=3","gravatar_id":"","url":"https://api.github.com/users/jsjason","html_url":"https://github.com/jsjason","followers_url":"https://api.github.com/users/jsjason/followers","following_url":"https://api.github.com/users/jsjason/following{/other_user}","gists_url":"https://api.github.com/users/jsjason/gists{/gist_id}","starred_url":"https://api.github.com/users/jsjason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsjason/subscriptions","organizations_url":"https://api.github.com/users/jsjason/orgs","repos_url":"https://api.github.com/users/jsjason/repos","events_url":"https://api.github.com/users/jsjason/events{/privacy}","received_events_url":"https://api.github.com/users/jsjason/received_events","type":"User","site_admin":false},"body":"What's the mean and variance of this distribution?","created_at":"2015-11-18T09:56:06Z","updated_at":"2015-11-18T09:56:06Z","html_url":"https://github.com/cmssnu/dolphin/pull/143#discussion_r45179517","pull_request_url":"https://api.github.com/repos/cmssnu/dolphin/pulls/143","_links":{"self":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/comments/45179517"},"html":{"href":"https://github.com/cmssnu/dolphin/pull/143#discussion_r45179517"},"pull_request":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/143"}}},"pull_request":{"url":"https://api.github.com/repos/cmssnu/dolphin/pulls/143","id":50205962,"html_url":"https://github.com/cmssnu/dolphin/pull/143","diff_url":"https://github.com/cmssnu/dolphin/pull/143.diff","patch_url":"https://github.com/cmssnu/dolphin/pull/143.patch","issue_url":"https://api.github.com/repos/cmssnu/dolphin/issues/143","number":143,"state":"open","locked":false,"title":"Introduce a new Matrix interface and implementation based on JBLAS","user":{"login":"beomyeol","id":7035999,"avatar_url":"https://avatars.githubusercontent.com/u/7035999?v=3","gravatar_id":"","url":"https://api.github.com/users/beomyeol","html_url":"https://github.com/beomyeol","followers_url":"https://api.github.com/users/beomyeol/followers","following_url":"https://api.github.com/users/beomyeol/following{/other_user}","gists_url":"https://api.github.com/users/beomyeol/gists{/gist_id}","starred_url":"https://api.github.com/users/beomyeol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beomyeol/subscriptions","organizations_url":"https://api.github.com/users/beomyeol/orgs","repos_url":"https://api.github.com/users/beomyeol/repos","events_url":"https://api.github.com/users/beomyeol/events{/privacy}","received_events_url":"https://api.github.com/users/beomyeol/received_events","type":"User","site_admin":false},"body":"Since `Nd4j` has several problem as mentioned in #142, this pull request introduces a new `Matrix` interface that supports `float` data type and will replace `Nd4j` library, and an implementation based on [jblas](http://jblas.org/).\r\nThe interface of `Matrix` is motivated by jblas's `FloatMatrix`, but does not have all methods of `FloatMatrix`. We can add methods which have not been implemented later if needed. \r\nIn addition, this pull request also introduces `Function` interface for activation functions and `MatrixUtils`, a utility class for `Matrix`.\r\nThe implementation of a sigmoid function is included in this PR and other implementations such as ReLU, Softmax, Tanh will be added later. `MatrixUtils` provides functions for comparison and `readNumpy()` for loading matrix data from Numpy-compatible plain text files.","created_at":"2015-11-10T02:14:16Z","updated_at":"2015-11-18T09:56:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb239990d18013e8cb38fe132052b47d8568862a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cmssnu/dolphin/pulls/143/commits","review_comments_url":"https://api.github.com/repos/cmssnu/dolphin/pulls/143/comments","review_comment_url":"https://api.github.com/repos/cmssnu/dolphin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cmssnu/dolphin/issues/143/comments","statuses_url":"https://api.github.com/repos/cmssnu/dolphin/statuses/d0bdbaff3e5ef4c45db6ab14144aeedc44f5a49f","head":{"label":"cmssnu:feature-142-jblas","ref":"feature-142-jblas","sha":"d0bdbaff3e5ef4c45db6ab14144aeedc44f5a49f","user":{"login":"cmssnu","id":6446990,"avatar_url":"https://avatars.githubusercontent.com/u/6446990?v=3","gravatar_id":"","url":"https://api.github.com/users/cmssnu","html_url":"https://github.com/cmssnu","followers_url":"https://api.github.com/users/cmssnu/followers","following_url":"https://api.github.com/users/cmssnu/following{/other_user}","gists_url":"https://api.github.com/users/cmssnu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmssnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmssnu/subscriptions","organizations_url":"https://api.github.com/users/cmssnu/orgs","repos_url":"https://api.github.com/users/cmssnu/repos","events_url":"https://api.github.com/users/cmssnu/events{/privacy}","received_events_url":"https://api.github.com/users/cmssnu/received_events","type":"Organization","site_admin":false},"repo":{"id":24580061,"name":"dolphin","full_name":"cmssnu/dolphin","owner":{"login":"cmssnu","id":6446990,"avatar_url":"https://avatars.githubusercontent.com/u/6446990?v=3","gravatar_id":"","url":"https://api.github.com/users/cmssnu","html_url":"https://github.com/cmssnu","followers_url":"https://api.github.com/users/cmssnu/followers","following_url":"https://api.github.com/users/cmssnu/following{/other_user}","gists_url":"https://api.github.com/users/cmssnu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmssnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmssnu/subscriptions","organizations_url":"https://api.github.com/users/cmssnu/orgs","repos_url":"https://api.github.com/users/cmssnu/repos","events_url":"https://api.github.com/users/cmssnu/events{/privacy}","received_events_url":"https://api.github.com/users/cmssnu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cmssnu/dolphin","description":"","fork":false,"url":"https://api.github.com/repos/cmssnu/dolphin","forks_url":"https://api.github.com/repos/cmssnu/dolphin/forks","keys_url":"https://api.github.com/repos/cmssnu/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmssnu/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmssnu/dolphin/teams","hooks_url":"https://api.github.com/repos/cmssnu/dolphin/hooks","issue_events_url":"https://api.github.com/repos/cmssnu/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/cmssnu/dolphin/events","assignees_url":"https://api.github.com/repos/cmssnu/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/cmssnu/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/cmssnu/dolphin/tags","blobs_url":"https://api.github.com/repos/cmssnu/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmssnu/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmssnu/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmssnu/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmssnu/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/cmssnu/dolphin/languages","stargazers_url":"https://api.github.com/repos/cmssnu/dolphin/stargazers","contributors_url":"https://api.github.com/repos/cmssnu/dolphin/contributors","subscribers_url":"https://api.github.com/repos/cmssnu/dolphin/subscribers","subscription_url":"https://api.github.com/repos/cmssnu/dolphin/subscription","commits_url":"https://api.github.com/repos/cmssnu/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmssnu/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmssnu/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmssnu/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmssnu/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/cmssnu/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmssnu/dolphin/merges","archive_url":"https://api.github.com/repos/cmssnu/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmssnu/dolphin/downloads","issues_url":"https://api.github.com/repos/cmssnu/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/cmssnu/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/cmssnu/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/cmssnu/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmssnu/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/cmssnu/dolphin/releases{/id}","created_at":"2014-09-29T04:33:24Z","updated_at":"2015-11-10T10:28:23Z","pushed_at":"2015-11-17T04:29:13Z","git_url":"git://github.com/cmssnu/dolphin.git","ssh_url":"git@github.com:cmssnu/dolphin.git","clone_url":"https://github.com/cmssnu/dolphin.git","svn_url":"https://github.com/cmssnu/dolphin","homepage":null,"size":2472,"stargazers_count":10,"watchers_count":10,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":40,"forks":3,"open_issues":40,"watchers":10,"default_branch":"master"}},"base":{"label":"cmssnu:master","ref":"master","sha":"92f5714c2206e4bd59ac7e0bae8e071fe8324f08","user":{"login":"cmssnu","id":6446990,"avatar_url":"https://avatars.githubusercontent.com/u/6446990?v=3","gravatar_id":"","url":"https://api.github.com/users/cmssnu","html_url":"https://github.com/cmssnu","followers_url":"https://api.github.com/users/cmssnu/followers","following_url":"https://api.github.com/users/cmssnu/following{/other_user}","gists_url":"https://api.github.com/users/cmssnu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmssnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmssnu/subscriptions","organizations_url":"https://api.github.com/users/cmssnu/orgs","repos_url":"https://api.github.com/users/cmssnu/repos","events_url":"https://api.github.com/users/cmssnu/events{/privacy}","received_events_url":"https://api.github.com/users/cmssnu/received_events","type":"Organization","site_admin":false},"repo":{"id":24580061,"name":"dolphin","full_name":"cmssnu/dolphin","owner":{"login":"cmssnu","id":6446990,"avatar_url":"https://avatars.githubusercontent.com/u/6446990?v=3","gravatar_id":"","url":"https://api.github.com/users/cmssnu","html_url":"https://github.com/cmssnu","followers_url":"https://api.github.com/users/cmssnu/followers","following_url":"https://api.github.com/users/cmssnu/following{/other_user}","gists_url":"https://api.github.com/users/cmssnu/gists{/gist_id}","starred_url":"https://api.github.com/users/cmssnu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmssnu/subscriptions","organizations_url":"https://api.github.com/users/cmssnu/orgs","repos_url":"https://api.github.com/users/cmssnu/repos","events_url":"https://api.github.com/users/cmssnu/events{/privacy}","received_events_url":"https://api.github.com/users/cmssnu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cmssnu/dolphin","description":"","fork":false,"url":"https://api.github.com/repos/cmssnu/dolphin","forks_url":"https://api.github.com/repos/cmssnu/dolphin/forks","keys_url":"https://api.github.com/repos/cmssnu/dolphin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cmssnu/dolphin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cmssnu/dolphin/teams","hooks_url":"https://api.github.com/repos/cmssnu/dolphin/hooks","issue_events_url":"https://api.github.com/repos/cmssnu/dolphin/issues/events{/number}","events_url":"https://api.github.com/repos/cmssnu/dolphin/events","assignees_url":"https://api.github.com/repos/cmssnu/dolphin/assignees{/user}","branches_url":"https://api.github.com/repos/cmssnu/dolphin/branches{/branch}","tags_url":"https://api.github.com/repos/cmssnu/dolphin/tags","blobs_url":"https://api.github.com/repos/cmssnu/dolphin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cmssnu/dolphin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cmssnu/dolphin/git/refs{/sha}","trees_url":"https://api.github.com/repos/cmssnu/dolphin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cmssnu/dolphin/statuses/{sha}","languages_url":"https://api.github.com/repos/cmssnu/dolphin/languages","stargazers_url":"https://api.github.com/repos/cmssnu/dolphin/stargazers","contributors_url":"https://api.github.com/repos/cmssnu/dolphin/contributors","subscribers_url":"https://api.github.com/repos/cmssnu/dolphin/subscribers","subscription_url":"https://api.github.com/repos/cmssnu/dolphin/subscription","commits_url":"https://api.github.com/repos/cmssnu/dolphin/commits{/sha}","git_commits_url":"https://api.github.com/repos/cmssnu/dolphin/git/commits{/sha}","comments_url":"https://api.github.com/repos/cmssnu/dolphin/comments{/number}","issue_comment_url":"https://api.github.com/repos/cmssnu/dolphin/issues/comments{/number}","contents_url":"https://api.github.com/repos/cmssnu/dolphin/contents/{+path}","compare_url":"https://api.github.com/repos/cmssnu/dolphin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cmssnu/dolphin/merges","archive_url":"https://api.github.com/repos/cmssnu/dolphin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cmssnu/dolphin/downloads","issues_url":"https://api.github.com/repos/cmssnu/dolphin/issues{/number}","pulls_url":"https://api.github.com/repos/cmssnu/dolphin/pulls{/number}","milestones_url":"https://api.github.com/repos/cmssnu/dolphin/milestones{/number}","notifications_url":"https://api.github.com/repos/cmssnu/dolphin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cmssnu/dolphin/labels{/name}","releases_url":"https://api.github.com/repos/cmssnu/dolphin/releases{/id}","created_at":"2014-09-29T04:33:24Z","updated_at":"2015-11-10T10:28:23Z","pushed_at":"2015-11-17T04:29:13Z","git_url":"git://github.com/cmssnu/dolphin.git","ssh_url":"git@github.com:cmssnu/dolphin.git","clone_url":"https://github.com/cmssnu/dolphin.git","svn_url":"https://github.com/cmssnu/dolphin","homepage":null,"size":2472,"stargazers_count":10,"watchers_count":10,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":40,"forks":3,"open_issues":40,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/143"},"html":{"href":"https://github.com/cmssnu/dolphin/pull/143"},"issue":{"href":"https://api.github.com/repos/cmssnu/dolphin/issues/143"},"comments":{"href":"https://api.github.com/repos/cmssnu/dolphin/issues/143/comments"},"review_comments":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/143/comments"},"review_comment":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cmssnu/dolphin/pulls/143/commits"},"statuses":{"href":"https://api.github.com/repos/cmssnu/dolphin/statuses/d0bdbaff3e5ef4c45db6ab14144aeedc44f5a49f"}}}}