ivy.solve(x1, x2, /, *, out=None)[source]#

Return the solution to the system of linear equations represented by the well- determined (i.e., full rank) linear matrix equation AX = B.

  • x1 (Union[Array, NativeArray]) – coefficient array A having shape (…, M, M) and whose innermost two dimensions form square matrices. Must be of full rank (i.e., all rows or, equivalently, columns must be linearly independent). Should have a floating-point data type.

  • x2 (Union[Array, NativeArray]) – ordinate (or “dependent variable”) array B. If x2 has shape (M,), x2 is equivalent to an array having shape (…, M, 1). If x2 has shape (…, M, K), each column k defines a set of ordinate values for which to compute a solution, and shape(x2)[:-1] must be compatible with shape(x1)[:-1] (see Broadcasting). Should have a floating-point data type.

  • out (Optional[Array]) – optional output array, for writing the result to. It must have a shape that the (default: None) inputs broadcast to.

Return type:



ret – an array containing the solution to the system AX = B for each square matrix. The returned array must have the same shape as x2 (i.e., the array corresponding to B) and must have a floating-point data type determined by Type Promotion Rules.

This function conforms to the Array API Standard. This docstring is an extension of the docstring # noqa in the standard.

Both the description and the type hints above assumes an array input for simplicity, but this function is nestable, and therefore also accepts ivy.Container instances in place of any of the arguments.

Array.solve(self, x2, /, *, adjoint=False, out=None)#
Return type:


Container.solve(self, x2, /, *, adjoint=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#
Return type: