dpnp.linalg.solve

dpnp.linalg.solve(a, b)[source]

Solve a linear matrix equation, or system of linear scalar equations.

For full documentation refer to numpy.linalg.solve.

Returns:

out – Solution to the system ax = b. Returned shape is identical to b.

Return type:

{(…, M,), (…, M, K)} dpnp.ndarray

Limitations

Parameters a and b are supported as either dpnp.ndarray or dpctl.tensor.usm_ndarray. Input array data types are limited by supported DPNP Data types.

See also

dpnp.dot

Returns the dot product of two arrays.

Examples

>>> import dpnp as dp
>>> a = dp.array([[1, 2], [3, 5]])
>>> b = dp.array([1, 2])
>>> x = dp.linalg.solve(a, b)
>>> x
array([-1.,  1.])

Check that the solution is correct:

>>> dp.allclose(dp.dot(a, x), b)
array([ True])