scipy 1.8.0 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
solve_triangular(a, b, trans=0, lower=False, unit_diagonal=False, overwrite_b=False, debug=None, check_finite=True)

Notes

versionadded

Parameters

a : (M, M) array_like

A triangular matrix

b : (M,) or (M, N) array_like

Right-hand side matrix in :None:None:`a x = b`

lower : bool, optional

Use only data contained in the lower triangle of a. Default is to use upper triangle.

trans : {0, 1, 2, 'N', 'T', 'C'}, optional

Type of system to solve:

======== ========= trans system ======== ========= 0 or 'N' a x = b 1 or 'T' a^T x = b 2 or 'C' a^H x = b ======== =========

unit_diagonal : bool, optional

If True, diagonal elements of a are assumed to be 1 and will not be referenced.

overwrite_b : bool, optional

Allow overwriting data in b (may enhance performance)

check_finite : bool, optional

Whether to check that the input matrices contain only finite numbers. Disabling may give a performance gain, but may result in problems (crashes, non-termination) if the inputs do contain infinities or NaNs.

Raises

LinAlgError

If a is singular

Returns

x : (M,) or (M, N) ndarray

Solution to the system :None:None:`a x = b`. Shape of return matches b.

Solve the equation :None:None:`a x = b` for x, assuming a is a triangular matrix.

Examples

[3 0 0 0] [4]

a = [2 1 0 0] b = [2]

[1 0 1 0] [4] [1 1 1 1] [2]

>>> from scipy.linalg import solve_triangular
... a = np.array([[3, 0, 0, 0], [2, 1, 0, 0], [1, 0, 1, 0], [1, 1, 1, 1]])
... b = np.array([4, 2, 4, 2])
... x = solve_triangular(a, b, lower=True)
... x array([ 1.33333333, -0.66666667, 2.66666667, -1.33333333])
>>> a.dot(x)  # Check the result
array([ 4.,  2.,  4.,  2.])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.linalg._basic.solve_triangular

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/linalg/_basic.py#264
type: <class 'function'>
Commit: