Title: How to do point point look up in arrayfire's array? · arrayfire/arrayfire-rust · Discussion #342 · GitHub
Open Graph Title: How to do point point look up in arrayfire's array? · arrayfire/arrayfire-rust · Discussion #342
X Title: How to do point point look up in arrayfire's array? · arrayfire/arrayfire-rust · Discussion #342
Description: How to do point point look up in arrayfire's array?
Open Graph Description: Let say, I have a 3d array called f mat = f(x,y,z) I want to look up from a list of points (x0,y0,z0).....(xn,yn,zn); by spliting it up into arr_x = x0, x1, ....xn; arr_y = y0, y1,....yn; arr_z = z...
X Description: Let say, I have a 3d array called f mat = f(x,y,z) I want to look up from a list of points (x0,y0,z0).....(xn,yn,zn); by spliting it up into arr_x = x0, x1, ....xn; arr_y = y0, y1,....yn; arr_z = z...
Opengraph URL: https://github.com/arrayfire/arrayfire-rust/discussions/342
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"How to do point point look up in arrayfire's array?","text":"Let say, I have a 3d array called f
\nmat = f(x,y,z)
\nI want to look up from a list of points (x0,y0,z0).....(xn,yn,zn);
\nby spliting it up into
\narr_x = x0, x1, ....xn;
\narr_y = y0, y1,....yn;
\narr_z = z0, z1.... zn;
\nI want to get the output like
\noutput = f(arr_x, arr_y, arr_z)
\nSince arr_x, arr_y, arr_z are random points, I have difficult to use \"lookup\", \"locate\", \"view!\", \"index_gen\", \"assign_seq\" to generate the \"output\" without converting the array \"f\" to a 1d array.
\nThe following code will not work as of my expectation because view! will do a permutation mapping of xs and ys. It will expand the dimension of output instead of doing point to point lookup.
\nThank in advance for your help.
\nEli
\n\nuse arrayfire::*;\n\nfn main() {\n let (h, w, ch) = (4, 2, 3);\n let x = range::<i32>(dim4!(1, w), 1);\n let y = range::<i32>(dim4!(h), 0);\n let z = range::<i32>(dim4!(1, 1, ch), 2);\n let xs = tile(&x, dim4!(h));\n let ys = tile(&y, dim4!(1, w));\n let zs = tile(&z, dim4!(h, w, 1));\n\n af_print!(\"xs=\", &xs);\n af_print!(\"ys=\", &ys);\n af_print!(\"zs=\", &zs);\n let out = view!(zs[xs, ys]);\n af_print!(\"out=\", &out);\n\n}\n
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"should use \"approx1\"
","upvoteCount":1,"url":"https://github.com/arrayfire/arrayfire-rust/discussions/342#discussioncomment-3546048"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:dc343a8d-455e-1961-0d17-c7706273f179 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | A772:374646:69D926:93205E:696E5C6C |
| html-safe-nonce | a484ddee01b59532883ef137b1f9ab4b6888cb55c63f398da6420ced84cff7d6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzcyOjM3NDY0Njo2OUQ5MjY6OTMyMDVFOjY5NkU1QzZDIiwidmlzaXRvcl9pZCI6IjQ5MzY3MTUzMTQxMDI1MDg2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bf780a6061f13238e69059a1fd3d53abd51cf7c489dc885a4f2cd7d9f750ca88 |
| hovercard-subject-tag | discussion:4359888 |
| github-keyboard-shortcuts | repository,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/Voltron::DiscussionsFragmentsController/show/arrayfire/arrayfire-rust/342/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/3afdb21d47969b5bd8cd4c6b358871ee3c00c8ccd078a46613568f3231e8ea6c/arrayfire/arrayfire-rust/discussions/342 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3afdb21d47969b5bd8cd4c6b358871ee3c00c8ccd078a46613568f3231e8ea6c/arrayfire/arrayfire-rust/discussions/342 |
| og:image:alt | Let say, I have a 3d array called f mat = f(x,y,z) I want to look up from a list of points (x0,y0,z0).....(xn,yn,zn); by spliting it up into arr_x = x0, x1, ....xn; arr_y = y0, y1,....yn; arr_z = z... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f68b42d371252b0f236260d6234f4304a806fe5ac43d59faa21fb59d80df103b |
| turbo-cache-control | no-preview |
| go-import | github.com/arrayfire/arrayfire-rust git https://github.com/arrayfire/arrayfire-rust.git |
| octolytics-dimension-user_id | 5395442 |
| octolytics-dimension-user_login | arrayfire |
| octolytics-dimension-repository_id | 35817370 |
| octolytics-dimension-repository_nwo | arrayfire/arrayfire-rust |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 35817370 |
| octolytics-dimension-repository_network_root_nwo | arrayfire/arrayfire-rust |
| 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 | 6b74bc8dbcd10b5d69fd9ee9d2cfdc8b35e18a4c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width