News for hackers. Stuff that matters.
Re:Copying data is wasteful, mutating data is dangerous by hannofcart on Friday January 10, 2020 @12:09AM (#22008467)
I think one way numerical computation APIs can offer optimizations of this sort is to expose a chaining API.

For eg:

chain(my_large_array).op1().op2().op3().result()

Using this, the chain() start could copy the input data once, but thereafter do a series of in place mutations in op1, op2 and op3 to improve performance.

Do numpy APIs provide such facilities?

Re:Copying data is wasteful, mutating data is dangerous by pornel on Friday January 10, 2020 @09:39AM (#22011194)
Rust iterators combine like that if the operations are per-element (iter + map + collect).

For optimizing complex access patterns you'd need a language like Halide.