This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / sparse / linalg / _dsolve / linsolve / use_solver

function

scipy.sparse.linalg._dsolve.linsolve:use_solver

source: build-install/usr/lib/python3.14/site-packages/scipy/sparse/linalg/_dsolve/linsolve.py:33

Signature

def use_solver(**kwargs)

Summary

Select default sparse direct solver to be used.

Parameters

**kwargs

The following options may be passed as keyword arguments.

useUmfpack

Use UMFPACK [1], [2], [3], [4]. over SuperLU. Has effect only if scikits.umfpack is installed. Default: True

assumeSortedIndices

Allow UMFPACK to skip the step of sorting indices for a CSR/CSC matrix. Has effect only if useUmfpack is True and scikits.umfpack is installed. Default: False

Notes

The default sparse solver is UMFPACK when available (scikits.umfpack is installed). This can be changed by passing useUmfpack = False, which then causes the always present SuperLU based solver to be used.

UMFPACK requires a CSR/CSC matrix to have sorted column/row indices. If sure that the matrix fulfills this, pass assumeSortedIndices=True to gain some speed.

Examples

import numpy as np
from scipy.sparse.linalg import use_solver, spsolve
from scipy.sparse import csc_array
R = np.random.randn(5, 5)
A = csc_array(R)
b = np.random.randn(5)
use_solver(useUmfpack=False) # enforce superLU over UMFPACK
x = spsolve(A, b)
np.allclose(A.dot(x), b)
use_solver(useUmfpack=True) # reset umfPack usage to default
✓

Aliases

  • scipy.sparse.linalg.use_solver