I echo with Robert that the contraction can be done with np.einsum(). Also, check out the np.tensordot() as well - it can also be used to perform contraction.
Shawn On Fri, Jan 15, 2016 at 12:32 PM, Robert Kern <robert.k...@gmail.com> wrote: > On Fri, Jan 15, 2016 at 5:30 PM, Nathaniel Smith <n...@pobox.com> wrote: >> >> On Jan 15, 2016 8:36 AM, "Li Jiajia" <jiaji...@gatech.edu> wrote: >> > >> > Hi all, >> > I’m a PhD student in Georgia Tech. Recently, we’re working on a survey >> > paper about tensor algorithms: basic tensor operations, tensor >> > decomposition >> > and some tensor applications. We are making a table to compare the >> > capabilities of different software and planning to include NumPy. We’d like >> > to make sure these parameters are correct to make a fair compare. Although >> > we have looked into the related documents, please help us to confirm these. >> > Besides, if you think there are more features of your software and a more >> > preferred citation, please let us know. We’ll consider to update them. We >> > want to show NumPy supports tensors, and we also include "scikit-tensor” in >> > our survey, which is based on NumPy. >> > Please let me know any confusion or any advice! >> > Thanks a lot! :-) >> > >> > Notice: >> > 1. “YES/NO” to show whether or not the software supports the operation >> > or has the feature. >> > 2. “?” means we’re not sure of the feature, and please help us out. >> > 3. “Tensor order” means the maximum number of tensor dimensions that >> > users can do with this software. >> > 4. For computational cores, >> > 1) "Element-wise Tensor Operation (A * B)” includes element-wise >> > add/minus/multiply/divide, also Kronecker, outer and Katri-Rao products. If >> > the software contains one of them, we mark “YES”. >> > 2) “TTM” means tensor-times-matrix multiplication. We distinguish TTM >> > from tensor contraction. If the software includes tensor contraction, it >> > can >> > also support TTM. >> > 3) For “MTTKRP”, we know most software can realize it through the above >> > two operations. We mark it “YES”, only if an specified optimization for the >> > whole operation. >> >> NumPy has support for working with multidimensional tensors, if you like, >> but it doesn't really use the tensor language and notation (preferring >> instead to think in terms of "arrays" as a somewhat more computationally >> focused and less mathematically focused conceptual framework). >> >> Which is to say that I actually have no idea what all those jargon terms >> you're asking about mean :-) I am suspicious that NumPy supports more of >> those operations than you have marked, just under different names/notation, >> but really can't tell either way for sure without knowing what exactly they >> are. > > In particular check if your operations can be expressed with einsum() > > http://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.einsum.html > > -- > Robert Kern > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion > -- Yuxiang "Shawn" Wang Gerling Haptics Lab University of Virginia yw...@virginia.edu +1 (434) 284-0836 https://sites.google.com/a/virginia.edu/yw5aj/ _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion