{"action":"created","issue":{"url":"https://api.github.com/repos/kokkos/kokkos/issues/224","repository_url":"https://api.github.com/repos/kokkos/kokkos","labels_url":"https://api.github.com/repos/kokkos/kokkos/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/kokkos/kokkos/issues/224/comments","events_url":"https://api.github.com/repos/kokkos/kokkos/issues/224/events","html_url":"https://github.com/kokkos/kokkos/issues/224","id":143314500,"number":224,"title":"DynRankView dimension information","user":{"login":"kyungjoo-kim","id":6992602,"avatar_url":"https://avatars.githubusercontent.com/u/6992602?v=3","gravatar_id":"","url":"https://api.github.com/users/kyungjoo-kim","html_url":"https://github.com/kyungjoo-kim","followers_url":"https://api.github.com/users/kyungjoo-kim/followers","following_url":"https://api.github.com/users/kyungjoo-kim/following{/other_user}","gists_url":"https://api.github.com/users/kyungjoo-kim/gists{/gist_id}","starred_url":"https://api.github.com/users/kyungjoo-kim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyungjoo-kim/subscriptions","organizations_url":"https://api.github.com/users/kyungjoo-kim/orgs","repos_url":"https://api.github.com/users/kyungjoo-kim/repos","events_url":"https://api.github.com/users/kyungjoo-kim/events{/privacy}","received_events_url":"https://api.github.com/users/kyungjoo-kim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-24T17:46:59Z","updated_at":"2016-03-24T17:56:15Z","closed_at":null,"body":"Suppose we have \r\n`Kokkos::DynRankView<...> a(3,2);'\r\n'a.rank() // 2'\r\n'a.dimension(0) // 3'\r\n'a.dimension(1) // 2'\r\n'a.dimension(2) // expect 0 but it will be 1 for an implementation reason`\r\n\r\nWhat I ask is if you can provide an user interface to get dimension information of DynRankView. I can also do 'mydim = a.rank() > 3 ? a.dimension(2) : 0' but probably most users want to have access function for this to prevent accidental mistakes.\r\n\r\nFor instance, 'dimension(a, 2) // return 0 if rank is smaller than 3 ' ?? or change dimension method in the Kokkos. \r\n\r\nBTW, how can I put a new line in the code block ? \r\n"},"comment":{"url":"https://api.github.com/repos/kokkos/kokkos/issues/comments/200949592","html_url":"https://github.com/kokkos/kokkos/issues/224#issuecomment-200949592","issue_url":"https://api.github.com/repos/kokkos/kokkos/issues/224","id":200949592,"user":{"login":"hcedwar","id":7605869,"avatar_url":"https://avatars.githubusercontent.com/u/7605869?v=3","gravatar_id":"","url":"https://api.github.com/users/hcedwar","html_url":"https://github.com/hcedwar","followers_url":"https://api.github.com/users/hcedwar/followers","following_url":"https://api.github.com/users/hcedwar/following{/other_user}","gists_url":"https://api.github.com/users/hcedwar/gists{/gist_id}","starred_url":"https://api.github.com/users/hcedwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcedwar/subscriptions","organizations_url":"https://api.github.com/users/hcedwar/orgs","repos_url":"https://api.github.com/users/hcedwar/repos","events_url":"https://api.github.com/users/hcedwar/events{/privacy}","received_events_url":"https://api.github.com/users/hcedwar/received_events","type":"User","site_admin":false},"created_at":"2016-03-24T17:56:15Z","updated_at":"2016-03-24T17:56:15Z","body":"The `a.dimension(r)` specification is to return 1 when `a.rank() <= r` is an intentional abstraction semantics decision, as opposed to an implementaton artifact.  Consider the following use-case.\r\n\r\n    for ( int i0 = 0 ; i0 < a.dimension(0) ; ++i0 )\r\n      for ( int i1 = 0 ; i1 < a.dimension(1) ; ++i1 )\r\n        for ( int i2 = 0 ; i2 < a.dimension(2) ; ++i2 )\r\n          a(i0,i1,i2) += 1 ;\r\n\r\nThe above pattern will work properly for `0 <= a.rank() < 4` as long as `a.dimension(r) == 1` for `a.rank() <= r`."}}