def solve_triangular(a, b, trans=<NUM_LIT:0>, lower=False, unit_diagonal=False,<EOL>overwrite_b=False, debug=False, check_finite=True):
if check_finite:<EOL><INDENT>a1, b1 = map(np.asarray_chkfinite,(a,b))<EOL><DEDENT>else:<EOL><INDENT>a1, b1 = map(np.asarray, (a,b))<EOL><DEDENT>if len(a1.shape) != <NUM_LIT:2> or a1.shape[<NUM_LIT:0>] != a1.shape[<NUM_LIT:1>]:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if a1.shape[<NUM_LIT:0>] != b1.shape[<NUM_LIT:0>]:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>overwrite_b = overwrite_b or _datacopied(b1, b)<EOL>if debug:<EOL><INDENT>print('<STR_LIT>',overwrite_b)<EOL><DEDENT>trans = {'<STR_LIT:N>': <NUM_LIT:0>, '<STR_LIT:T>': <NUM_LIT:1>, '<STR_LIT:C>': <NUM_LIT:2>}.get(trans, trans)<EOL>trtrs, = get_lapack_funcs(('<STR_LIT>',), (a1,b1))<EOL>x, info = trtrs(a1, b1, overwrite_b=overwrite_b, lower=lower,<EOL>trans=trans, unitdiag=unit_diagonal)<EOL>if info == <NUM_LIT:0>:<EOL><INDENT>return x<EOL><DEDENT>if info > <NUM_LIT:0>:<EOL><INDENT>raise LinAlgError("<STR_LIT>" % (info-<NUM_LIT:1>))<EOL><DEDENT>raise ValueError('<STR_LIT>'<EOL>% -info)<EOL>
Solve the equation `a x = b` for `x`, assuming a is a triangular matrix.

Parameters
----------
a : (M, M) array_like
    A triangular matrix
b : (M,) or (M, N) array_like
    Right-hand side matrix in `a x = b`
lower : boolean
    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.

Returns
-------
x : (M,) or (M, N) ndarray
    Solution to the system `a x = b`.  Shape of return matches `b`.

Raises
------
LinAlgError
    If `a` is singular

Notes
-----
.. versionadded:: 0.9.0