File: array-linear-operator.rst

package info (click to toggle)
dask 2021.01.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,172 kB
  • sloc: python: 74,608; javascript: 186; makefile: 150; sh: 94
file content (28 lines) | stat: -rw-r--r-- 737 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
LinearOperator
==============

Dask Array implements the SciPy LinearOperator_ interface and it can be used
with any SciPy algorithm depending on that interface.

Example
-------

.. code-block:: python

   import dask.array as da
   x = da.random.random(size=(10000, 10000), chunks=(1000, 1000))

   from scipy.sparse.linalg.interface import MatrixLinearOperator
   A = MatrixLinearOperator(x)

   import numpy as np
   b = np.random.random(10000)

   from scipy.sparse.linalg import gmres
   x = gmres(A, b)

*Disclaimer: This is just a toy example and not necessarily the best way to
solve this problem for this data.*


.. _LinearOperator: https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.LinearOperator.html