Matlab semantics (original) (raw)

This is reasonably new and readable:

It would be interesting to look at the details of how some of this would lower into TCP. It might be necessary to have TCF map directly into this.

Thanks for the link!!!

Besides the “writing out of bounds of the array enlarges the array”, it looks like the matlab core array type is fairly similar to numpy.

E.g. it looks like matlab has identical broadcasting behavior (rank broadcasting and size-1 broadcasting), so any code and transformations are the same.

I didn’t see anything about the ragged behavior you mentioned on the ODM call in the core “array” type. It seems that there is a separate construct called a “cell array” which can be ragged. In numpy/Python terminology, this “cell array” is seems to be just a (Python) list of (Pyton) lists of (Python) lists of …, or in the hyperrectangular case equivalent to a numpy array with dtype=object.

So to summarize, at least from my cursory investigation here, it seems like besides some thorny issues to de-dynamize the overall language and paper over that “writing out of bounds of the array enlarges the array” semantic it should layer pretty nicely with “numpy-TCF” as I’ve sketched it here.

Does anybody have contact info for the Frederic in the ODM today. They seemed to have some interesting points and I would find their perspectives useful in this discussion.

I really like the Theano broadcasting semantics, where besides a shape a “broadcastable” bool is tracked for each dimension of a tensor: http://deeplearning.net/software/theano/tutorial/broadcasting.html

It would be kind of cool if our tensor type could represent that (along with a ? for the element type as well)

I will email Frederic pointing to this thread.

Yes. most Matlab code probably doesn’t hit this kind of thing, so in most cases it’s probably sufficient to just fall back to a slow unoptimized code path for the awkward bits. The nice thing about Matlab is that it’s reasonably well studied 'cuz it’s been around forever.

Parallel Matlab: https://www.ll.mit.edu/sites/default/files/page/doc/2018-11/pMatlab_intro.pdf Looks like an interesting model which is implemented with matlab overloads, but explicitly represents the distribution of a matrix in a user’s program.