Title: Zip and azip! behavior related to inputted NdProducers · Issue #453 · rust-ndarray/ndarray · GitHub
Open Graph Title: Zip and azip! behavior related to inputted NdProducers · Issue #453 · rust-ndarray/ndarray
X Title: Zip and azip! behavior related to inputted NdProducers · Issue #453 · rust-ndarray/ndarray
Description: Based on trying to help in Issue #452 , I found some interesting behavior regarding either Zip or azip!. I've given examples down below let a = arr3(&[[[ 0, 1, 2], [ 3, 4, 5]], [[ 6, 7, 8], [ 9, 10, 11]]]); let inner0 = a.lanes(Axis(0));...
Open Graph Description: Based on trying to help in Issue #452 , I found some interesting behavior regarding either Zip or azip!. I've given examples down below let a = arr3(&[[[ 0, 1, 2], [ 3, 4, 5]], [[ 6, 7, 8], [ 9, 10...
X Description: Based on trying to help in Issue #452 , I found some interesting behavior regarding either Zip or azip!. I've given examples down below let a = arr3(&[[[ 0, 1, 2], [ 3, 4, 5]], [[ 6, 7, 8],...
Opengraph URL: https://github.com/rust-ndarray/ndarray/issues/453
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Zip and azip! behavior related to inputted NdProducers","articleBody":"Based on trying to help in Issue #452 , I found some interesting behavior regarding either `Zip` or `azip!`. I've given examples down below\r\n\r\n```\r\n let a = arr3(\u0026[[[ 0, 1, 2],\r\n [ 3, 4, 5]],\r\n [[ 6, 7, 8],\r\n [ 9, 10, 11]]]);\r\n let inner0 = a.lanes(Axis(0));\r\n\r\n let trial = arr1(\u0026[0,0,0,0,0,0]);\r\n let tr_iter = trial.axis_iter(Axis(0));\r\n\r\n //The below will error out when compiling.\r\n azip!(ref output (inner0), ref trial (tr_iter) in {println!(\"{:?}, {:?}\",output, trial); });\r\n```\r\nThe compiler returns the following error:\r\n\r\n```\r\nerror[E0271]: type mismatch resolving `\u003cndarray::iter::AxisIter\u003c'_, {integer}, ndarray::Dim\u003c[usize; 0]\u003e\u003e as ndarray::IntoNdProducer\u003e::Dim == ndarray::Dim\u003c[usize; 2]\u003e`\r\n --\u003e src/main.rs:141:5\r\n |\r\n141 | azip!(ref output (inner0), ref trial (tr_iter) in {println!(\"{:?}, {:?}\",output, trial); });\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an array with a fixed size of 1 elements, found one with 2 elements\r\n |\r\n = note: expected type `ndarray::Dim\u003c[usize; 1]\u003e`\r\n found type `ndarray::Dim\u003c[usize; 2]\u003e`\r\n = note: this error originates in a macro outside of the current crate\r\n\r\nerror[E0599]: no method named `apply` found for type `ndarray::Zip\u003c(ndarray::iter::Lanes\u003c'_, {integer}, ndarray::Dim\u003c[usize; 2]\u003e\u003e, ndarray::iter::AxisIter\u003c'_, {integer}, ndarray::Dim\u003c[usize; 0]\u003e\u003e), ndarray::Dim\u003c[usize; 2]\u003e\u003e` in the current scope\r\n --\u003e src/main.rs:141:5\r\n |\r\n141 | azip!(ref output (inner0), ref trial (tr_iter) in {println!(\"{:?}, {:?}\",output, trial); });\r\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n |\r\n = note: this error originates in a macro outside of the current crate\r\n```\r\n\r\n\r\nHowever, if I were to roll what inner0 outputs directly, I can get it to work no problem as seen below:\r\n\r\n\r\n```\r\n let trial = arr1(\u0026[0,0,0,0,0,0]);\r\n let tr_iter = trial.axis_iter(Axis(0));\r\n\r\n let b = arr2(\u0026[[0,1,2,3,4,5],[6,7,8,9,10,11]]);\r\n let b_iter = b.axis_iter(Axis(1));\r\n //The compiler is perfectly okay with this code.\r\n azip!(ref output (b_iter), ref trial (tr_iter) in {println!(\"{:?}, {:?}\",output, trial); });\r\n```\r\n\r\nI feel that either method should work, since we contain the same number of \"items\" to iterate over in each version. So, I was curious if this is simply an error/bug in the code or is there a design choice behind one method failing to compile and the other one working.","author":{"url":"https://github.com/rcarson3","@type":"Person","name":"rcarson3"},"datePublished":"2018-05-17T22:32:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/453/ndarray/issues/453"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c241100d-dd42-94cd-572b-98bcfe0af0fa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD22:1427E7:490E6BA:5F02259:69750617 |
| html-safe-nonce | fc2d2399cdaa0a2bd1494f7a7744e932494221e12ded0af3bbc1a208cc9bb44f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDIyOjE0MjdFNzo0OTBFNkJBOjVGMDIyNTk6Njk3NTA2MTciLCJ2aXNpdG9yX2lkIjoiNjQyODEzNjYyNzIyNTU2MDU5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 42d1661ad5eee9f0c7f8468a8f245da60e01309aaf36b0495ede167875dc70e3 |
| hovercard-subject-tag | issue:324208875 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/rust-ndarray/ndarray/453/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b454a99c717fe442e45b63fa0f8d55bb3dab5ab9ca1b7bcb7245ad010d55dd6d/rust-ndarray/ndarray/issues/453 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b454a99c717fe442e45b63fa0f8d55bb3dab5ab9ca1b7bcb7245ad010d55dd6d/rust-ndarray/ndarray/issues/453 |
| og:image:alt | Based on trying to help in Issue #452 , I found some interesting behavior regarding either Zip or azip!. I've given examples down below let a = arr3(&[[[ 0, 1, 2], [ 3, 4, 5]], [[ 6, 7, 8], [ 9, 10... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rcarson3 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| turbo-cache-control | no-preview |
| go-import | github.com/rust-ndarray/ndarray git https://github.com/rust-ndarray/ndarray.git |
| octolytics-dimension-user_id | 44419403 |
| octolytics-dimension-user_login | rust-ndarray |
| octolytics-dimension-repository_id | 22598813 |
| octolytics-dimension-repository_nwo | rust-ndarray/ndarray |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 22598813 |
| octolytics-dimension-repository_network_root_nwo | rust-ndarray/ndarray |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width