Skip to content

Supporting full_matrices argument with Dask's svd #3576

@jakirkham

Description

@jakirkham

Ran into an issue where NumPy's svd and Dask's svd would provide different shaped arrays. An example of this behavior is included below with details about the environment used to reproduce it.

Example:
In [1]: import numpy as np

In [2]: import dask.array as da

In [3]: m, n = 20, 10

In [4]: a = np.random.rand(m, n)

In [5]: d_a = da.from_array(a, chunks=(3, n), name='A')

In [6]: d_u, d_s, d_vt = da.linalg.svd(d_a)

In [7]: u, s, vt = np.linalg.svd(a)

In [8]: assert d_u.shape == u.shape
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-8-dffa2c855847> in <module>()
----> 1 assert d_u.shape == u.shape

AssertionError: 

In [9]: d_u.shape
Out[9]: (20, 10)

In [10]: u.shape
Out[10]: (20, 20)

Environment:
name: test
channels:
  - conda-forge
  - defaults
dependencies:
  - appnope=0.1.0=py36_0
  - backcall=0.1.0=py_0
  - blas=1.1=openblas
  - bokeh=0.12.16=py36_0
  - ca-certificates=2018.4.16=0
  - certifi=2018.4.16=py36_0
  - click=6.7=py_1
  - cloudpickle=0.5.3=py_0
  - cycler=0.10.0=py36_0
  - cytoolz=0.9.0.1=py36_0
  - dask=0.17.5=py_0
  - dask-core=0.17.5=py_0
  - decorator=4.3.0=py_0
  - distributed=1.21.8=py36_0
  - freetype=2.8.1=0
  - graphviz=2.38.0=7
  - heapdict=1.0.0=py36_0
  - ipython=6.4.0=py36_0
  - ipython_genutils=0.2.0=py36_0
  - jedi=0.12.0=py36_0
  - jinja2=2.10=py36_0
  - jpeg=9b=2
  - kiwisolver=1.0.1=py36_1
  - libgfortran=3.0.0=0
  - libpng=1.6.34=0
  - libtiff=4.0.9=0
  - locket=0.2.0=py36_1
  - markupsafe=1.0=py36_0
  - matplotlib=2.2.2=py36_1
  - msgpack-python=0.5.6=py36h2d50403_2
  - ncurses=5.9=10
  - numpy=1.14.3=py36_blas_openblas_200
  - openblas=0.2.20=8
  - openssl=1.0.2o=0
  - packaging=17.1=py_0
  - pandas=0.23.0=py36_1
  - parso=0.2.1=py_0
  - partd=0.3.8=py36_0
  - pexpect=4.6.0=py36_0
  - pickleshare=0.7.4=py36_0
  - prompt_toolkit=1.0.15=py36_0
  - psutil=5.4.5=py36_0
  - ptyprocess=0.5.2=py36_0
  - pygments=2.2.0=py36_0
  - pyparsing=2.2.0=py36_0
  - python=3.6.5=1
  - python-dateutil=2.7.3=py_0
  - python-graphviz=0.8.3=py36_0
  - pytz=2018.4=py_0
  - pyyaml=3.12=py36_1
  - readline=7.0=0
  - setuptools=39.2.0=py36_0
  - simplegeneric=0.8.1=py36_0
  - six=1.11.0=py36_1
  - sortedcontainers=2.0.2=py36_0
  - sqlite=3.20.1=2
  - tblib=1.3.2=py36_0
  - tk=8.6.7=0
  - toolz=0.9.0=py_0
  - tornado=5.0.2=py36_0
  - traitlets=4.3.2=py36_0
  - wcwidth=0.1.7=py36_0
  - xz=5.2.3=0
  - yaml=0.1.7=0
  - zict=0.1.3=py_0
  - zlib=1.2.11=h470a237_3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions