Temporary arrays for other things, like C = A * B (or, more relevant, C = A .* B), is an optimization issue actively being worked on. But it’s a hard one to solve, unlike avoiding meshgrid. Furthermore; if you avoid using meshgrid, you’ll avoid falling on this performance bottleneck too, as you will probably be able to avoid this type of array operation entirely.
Since building a meshgrid function yourself is so easy (and will be just as fast and as good as if it was included in Base), but using it is potentially harmful to performance, I think there are good reasons to keep it out of Base. If you really want to use it, it’s a one-liner in .juliarc away, and as long as it’s not in Base there’s a good chance that beginner Julians will pick up more performant idioms. I'll look into posting this somewhere less transient, to make it available for linking from the Julia vs MATLAB FAQ. // T On Wednesday, March 9, 2016 at 11:02:26 AM UTC+1, Tobias Knopp wrote: I also don't see the major issue with the inefficiency of meshgrid. > We do provide functions for evaluating > > c = a * b > > with a, b being vectors and we know that it is not efficient to do so (due > to the temporary vector introduced) > > Tobi > > Am Mittwoch, 9. März 2016 10:54:18 UTC+1 schrieb Christoph Ortner: >> >> Nice list of alternatives. >> >> But it doesn't change the fact that meshgrid is very easy to use, and >> very easy to read. New idioms should not be forced on developers. I know in >> what ways mesh grid is inefficient and when that matters then I won't use >> it. But more often than not I just want a quick have for a simple problem, >> and then I will use meshgrid over list comprehensions, etc. any time. >> >> Christoph >> >
