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
@ben-ng: this is ridiculously late, but I've added ndarray-concat-rows and ndarray-concat-cols to merge arrays. It includes the option to let it allocate new storage. It's not exactly what you want(ed), but it's in the ballpark.
Though to answer your specific question, there's no truly fast way, in general. There are cases where you could just extend the data array and that would be the last column, but it may also be the case that it's transposed and the new column is staggered throughout the data. So to answer the question, yes, I think in general at least, you need to allocate a new array.
For the case where the new column is contiguous, if you used a plain Array, it'd just expand to accommodate the new entries if you messed with the stride, shape, and offset, but since that's not generally applicable, I'll close this in favor of the above solutions and just having to do it manually sometimes, if that's alright.
Oh, and in case you weren't onto totally different stuff a year and a half ago already, see also: scijs-ndarray-for-matlab-users
Hey Mikola, do you know of a fast way to add a column to a 2d array?
This is just a shot in the dark; I have a feeling that I need to allocate a new typed array to achieve this.
The text was updated successfully, but these errors were encountered: