4 ms·
Any array in several indices is using a tensor product. x[1][2][3] On StackOverflow, I asked about making an multiplication table in Python. [[a*b fo
by mrcactu5 13y ago
Any array in several indices is using a tensor product.
x[1][2][3]
On StackOverflow, I asked about making an multiplication table in Python.
[[a*b for a in x] for b in y]
or in NumPy
x[..., None]*y[None,...]
This is an example of a tensor product between two arrays in order to get a matrix.
http://stackoverflow.com/questions/20501073/product-of-arrays-of-different-sizes-in-numpy http://stackoverflow.com/questions/20501073/product-of-array...
- 33a 13y agoThat's a cartesian product, not a tensor product.
- acjohnson55 13y agoI think it might be a bit more correct to call it the outer product.
- mrcactu5 13y agothe outer product is the tensor product of two vectors https://en.wikipedia.org/wiki/Outer_product https://en.wikipedia.org/wiki/Outer_product
- bsaul 13y agoCould that be the start of an introduction to tensor products or even tensors in general ? Start with cartesian product ( or maybe even sql joins ? ) and generalize ? It's probably much more intuitive to us developpers than vector products ( unless you're in 3D graphics or physic engine of course )