mnick / scikit-tensor

Python library for multilinear algebra and tensor factorizations
GNU General Public License v3.0
401 stars 113 forks source link

Error with Python 3.4 in cp_als: unsupported operand types for +:'range' and 'range' #6

Closed kastnerkyle closed 10 years ago

kastnerkyle commented 10 years ago

Reproduction script is the example in the README

Python 3.4.1 |Anaconda 2.0.0 (64-bit)| (default, May 19 2014, 13:02:41) [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux

git commit ef063d0e2f7f3160caf05b2b988ef3479ea2e1c9

Works fine in 2.7 (I switched to a 2.7 environment using Anaconda)

Traceback (most recent call last):
  File "tmp.py", line 13, in <module>
    P, fit, itr, exectimes = cp_als(T, 3, init='random')
  File "/home/kkastner/src/scikit-tensor/sktensor/cp.py", line 143, in als
    Unew = X.uttkrp(U, n)
  File "/home/kkastner/src/scikit-tensor/sktensor/dtensor.py", line 162, in uttkrp
    order = range(n) + range(n + 1, self.ndim)
TypeError: unsupported operand type(s) for +: 'range' and 'range'

I will take a look and see if I can submit a PR

kastnerkyle commented 10 years ago

I made a pull request - see #7