Understanding NumPy’s einsum

(Note: this answer is based on a short blog post about einsum I wrote a while ago.) What does einsum do? Imagine that we have two multi-dimensional arrays, A and B. Now let’s suppose we want to… multiply A with B in a particular way to create new array of products; and then maybe sum this new array along particular axes; and then maybe transpose the axes of the new … Read more

How to have an array of arrays in Python

3 From Microsoft documentation: A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes Python documentation about Data Structures. You could store a list inside another list or a dictionary that stores a list. Depending on how deep your arrays go, this might … Read more