{"action":"created","issue":{"url":"https://api.github.com/repos/ryanrhymes/owl/issues/117","repository_url":"https://api.github.com/repos/ryanrhymes/owl","labels_url":"https://api.github.com/repos/ryanrhymes/owl/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/ryanrhymes/owl/issues/117/comments","events_url":"https://api.github.com/repos/ryanrhymes/owl/issues/117/events","html_url":"https://github.com/ryanrhymes/owl/issues/117","id":265623202,"number":117,"title":"row function allows modification of argument but col doesn't","user":{"login":"mars0i","id":1836941,"avatar_url":"https://avatars0.githubusercontent.com/u/1836941?v=4","gravatar_id":"","url":"https://api.github.com/users/mars0i","html_url":"https://github.com/mars0i","followers_url":"https://api.github.com/users/mars0i/followers","following_url":"https://api.github.com/users/mars0i/following{/other_user}","gists_url":"https://api.github.com/users/mars0i/gists{/gist_id}","starred_url":"https://api.github.com/users/mars0i/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mars0i/subscriptions","organizations_url":"https://api.github.com/users/mars0i/orgs","repos_url":"https://api.github.com/users/mars0i/repos","events_url":"https://api.github.com/users/mars0i/events{/privacy}","received_events_url":"https://api.github.com/users/mars0i/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-10-16T01:25:54Z","updated_at":"2017-10-17T16:37:33Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Modifying the result of `row` affects its argument matrix, while modifying the result of `col` does not. My guess is that this difference has to do with efficiency and the underlying ndarray structure.  It seems confusing that `row` and `col` behave differently.  I don't know whether it would make sense to modify one of these functions.  One option is to leave the definitions as they are now but change the doc comments so that users know about the difference.\r\n```ocaml\r\n# let m = Mat.sequential 2 2;;\r\nval m : Mat.mat =\r\n  C0 C1\r\nR0  0  1\r\nR1  2  3\r\n\r\n# let r0 = Mat.row m 0;;\r\nval r0 : Mat.mat =\r\n  C0 C1\r\nR0  0  1\r\n\r\n# let c0 = Mat.col m 0;;\r\nval c0 : Mat.mat =\r\n  C0\r\nR0  0\r\nR1  2\r\n\r\n# Mat.set r0 0 1 42.;;\r\n- : unit = ()\r\n# Mat.set c0 1 0 42.;;\r\n- : unit = ()\r\n# m;;\r\n- : Mat.mat =\r\n  C0 C1\r\nR0  0 42\r\nR1  2  3\r\n```"},"comment":{"url":"https://api.github.com/repos/ryanrhymes/owl/issues/comments/337290901","html_url":"https://github.com/ryanrhymes/owl/issues/117#issuecomment-337290901","issue_url":"https://api.github.com/repos/ryanrhymes/owl/issues/117","id":337290901,"user":{"login":"ryanrhymes","id":1721505,"avatar_url":"https://avatars1.githubusercontent.com/u/1721505?v=4","gravatar_id":"","url":"https://api.github.com/users/ryanrhymes","html_url":"https://github.com/ryanrhymes","followers_url":"https://api.github.com/users/ryanrhymes/followers","following_url":"https://api.github.com/users/ryanrhymes/following{/other_user}","gists_url":"https://api.github.com/users/ryanrhymes/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanrhymes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanrhymes/subscriptions","organizations_url":"https://api.github.com/users/ryanrhymes/orgs","repos_url":"https://api.github.com/users/ryanrhymes/repos","events_url":"https://api.github.com/users/ryanrhymes/events{/privacy}","received_events_url":"https://api.github.com/users/ryanrhymes/received_events","type":"User","site_admin":false},"created_at":"2017-10-17T16:37:33Z","updated_at":"2017-10-17T16:37:33Z","author_association":"OWNER","body":"@mars0i thanks for pointing it out, this actually relates to our previous discussion https://github.com/ryanrhymes/owl/issues/98\r\n\r\n`row` returns a \"pointer\" to the same memory without copy whereas `col` returns a copy. You are right this is due to performance consideration. Because Owl sticks to c memory layout so taking a row is taking continuous memory block, much faster than retrieving a `col`.\r\n\r\nI think the best option for now is emphasising that in the documentation."}}
{"actor":{"display_login":"ryanrhymes"}}