You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the closed issue on broadcasting support, but while that link linked to broadcasting, it seemed to me that the OP was asking for something different.
But, more importantly, broadcasting has specific semantics attched to it, which I can see why you would not /could not support them in Kotlin. But a general way to apply some transformation to one dimension, eg. subtracting a vector from all entries in a matrix, seems warranted to me.
What I currently do is less efficient and only works on the first dimension:
fun <T>D2Array<T>.broadcastInplace(operation: (input: MultiArray<T, D1>) ->D1Array<T>) {
for (idx in0 until this.shape[0]) {
this[idx] = operation(this[idx])
}
}
At the very least a way to loop through different dimensions would be appreciated.
The text was updated successfully, but these errors were encountered:
I'm still thinking about it. So far, I'm only considering the option of broadcasting with copying, because any inplace operations cause a lot of problems.
Yeah, I'd be able to live with that. This particular bit was just to closer match numpy, in which I had written the reference implementation of that algorithm, but at least I'd have found a way to live with copying. At least for now, performance isnt THAT critical yet.
Feel free to keep this open or close it how you like.
I read the closed issue on broadcasting support, but while that link linked to broadcasting, it seemed to me that the OP was asking for something different.
But, more importantly, broadcasting has specific semantics attched to it, which I can see why you would not /could not support them in Kotlin. But a general way to apply some transformation to one dimension, eg. subtracting a vector from all entries in a matrix, seems warranted to me.
What I currently do is less efficient and only works on the first dimension:
At the very least a way to loop through different dimensions would be appreciated.
The text was updated successfully, but these errors were encountered: