Skip to main content
17 events
when toggle format what by license comment
May 19, 2023 at 22:59 vote accept Pierre Levoisin
May 17, 2023 at 17:38 comment added Peilonrayz I've read over the linked meta post "moral, practical, and legal reasons" again and have some concerns around the topicality of your question. Your question could be on-topic, however you've not answered Mast. So the topicality of the question is neither clearly defined to be on or off topic. I've put the question on hold until the concerns have been resolved.
May 17, 2023 at 17:38 comment added Mast You copied the code, but I can find no indication you made it your own. You copied code that's part of a speed comparison ran in Python, hence the py namespace. When asked questions about the code, there is no response. Please read Why is only my own written code on-topic?
May 17, 2023 at 17:28 history closed Peilonrayz Not suitable for this site
May 17, 2023 at 16:45 history removed from network questions Mast
May 17, 2023 at 15:43 comment added qwr All the comments here are hinting at an XY problem. Can you post your R code? It's very easy to get massive slowdowns in R if you're not careful with copies. Do you really need a complete distance matrix that is 1M x 1M?
May 17, 2023 at 14:52 history became hot network question
May 17, 2023 at 13:37 comment added Davislor Welcome to the site. What would really be more helpful to us and you is if you write your own code to solve the actual problem you care about—you can tag it as beginner if you want—and ask our advice on that.
May 17, 2023 at 3:15 comment added Davislor @J_H If you don’t need that much precision, changing the element type from double to float allows my code to auto-vectorize eight elements at once. It probably would not help the original much, since that version does not vectorize. (Better yet, reokace double everywhere with elem_t and set using elem_t = double;, so you can change it in one place and compare.)
May 16, 2023 at 23:55 answer added Davislor timeline score: 10
May 16, 2023 at 23:23 comment added J_H You proposed that revised code might run in 6 nanoseconds. How many nanoseconds are consumed by the current code? Posting a relevant godbolt.org link would be helpful. You did not describe your use case, but I'm guessing that looping till we achieve accuracy of .01 ångström won't make a practical difference for most traveling salesman problems. You use doubles. Rather than making a million calls, you probably want to take Davislor's hint and accept a vector of a million (lat,lng) single-floats. I do hope you're not performing 10^12 all-pairs distance calculations....
May 16, 2023 at 17:44 comment added Mast Do you understand why the code was written the way it is or just find it on the internet?
May 16, 2023 at 17:15 comment added Davislor Also, why do you import pybind11? You don’t seem to ever use it.
May 16, 2023 at 17:14 comment added Davislor Do you have the option of changing the API to take and return structures of arrays, so that you could use SIMD?
May 16, 2023 at 16:17 review Close votes
May 17, 2023 at 17:34
S May 16, 2023 at 15:52 review First questions
May 16, 2023 at 16:03
S May 16, 2023 at 15:52 history asked Pierre Levoisin CC BY-SA 4.0