#NEWLINE# def cho_solve( c_and_lower , b , overwrite_b = False , check_finite = True ) : #NEWLINE# #INDENT# 'Solve the linear equations A x = b, given the Cholesky factorization of A.\n\n    Parameters\n    ----------\n    (c, lower) : tuple, (array, bool)\n        Cholesky factorization of a, as given by cho_factor\n    b : array\n        Right-hand side\n    overwrite_b : bool, optional\n        Whether to overwrite data in b (may improve performance)\n    check_finite : bool, optional\n        Whether to check that the input matrices contain only finite numbers.\n        Disabling may give a performance gain, but may result in problems\n        (crashes, non-termination) if the inputs do contain infinities or NaNs.\n\n    Returns\n    -------\n    x : array\n        The solution to the system A x = b\n\n    See also\n    --------\n    cho_factor : Cholesky factorization of a matrix\n\n    ' #NEWLINE# ( c , lower ) = c_and_lower #NEWLINE# if check_finite : #NEWLINE# #INDENT# b1 = asarray_chkfinite ( b ) #NEWLINE# c = asarray_chkfinite ( c ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# b1 = asarray ( b ) #NEWLINE# c = asarray ( c ) #NEWLINE# #UNINDENT# if ( ( c . ndim != 2 ) or ( c . shape [ 0 ] != c . shape [ 1 ] ) ) : #NEWLINE# #INDENT# raise ValueError ( 'The factored matrix c is not square.' ) #NEWLINE# #UNINDENT# if ( c . shape [ 1 ] != b1 . shape [ 0 ] ) : #NEWLINE# #INDENT# raise ValueError ( 'incompatible dimensions.' ) #NEWLINE# #UNINDENT# overwrite_b = ( overwrite_b or _datacopied ( b1 , b ) ) #NEWLINE# ( potrs , ) = get_lapack_funcs ( ( 'potrs' , ) , ( c , b1 ) ) #NEWLINE# ( x , info ) = potrs ( c , b1 , lower = lower , overwrite_b = overwrite_b ) #NEWLINE# if ( info != 0 ) : #NEWLINE# #INDENT# raise ValueError ( ( 'illegal value in %d-th argument of internal potrs' % ( - c_and_lower ) ) ) #NEWLINE# #UNINDENT# return x