1 /*
2 
3     Copyright (C) 2014, The University of Texas at Austin
4 
5     This file is part of libflame and is available under the 3-Clause
6     BSD license, which can be found in the LICENSE file at the top-level
7     directory, or at http://opensource.org/licenses/BSD-3-Clause
8 
9 */
10 
11 #include "FLAME.h"
12 
FLA_Chol_solve(FLA_Uplo uplo,FLA_Obj A,FLA_Obj B,FLA_Obj X)13 FLA_Error FLA_Chol_solve( FLA_Uplo uplo, FLA_Obj A, FLA_Obj B, FLA_Obj X )
14 {
15   // Check parameters.
16   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
17     FLA_Chol_solve_check( uplo, A, B, X );
18 
19   if ( FLA_Obj_is_identical( B, X ) == FALSE )
20     FLA_Copy_external( B, X );
21 
22   if ( uplo == FLA_LOWER_TRIANGULAR )
23   {
24       FLA_Trsm_external( FLA_LEFT, FLA_LOWER_TRIANGULAR, FLA_NO_TRANSPOSE,
25                          FLA_NONUNIT_DIAG, FLA_ONE, A, X );
26       FLA_Trsm_external( FLA_LEFT, FLA_LOWER_TRIANGULAR, FLA_CONJ_TRANSPOSE,
27                          FLA_NONUNIT_DIAG, FLA_ONE, A, X );
28   }
29   else // if ( uplo == FLA_UPPER_TRIANGULAR )
30   {
31       FLA_Trsm_external( FLA_LEFT, FLA_UPPER_TRIANGULAR, FLA_CONJ_TRANSPOSE,
32                          FLA_NONUNIT_DIAG, FLA_ONE, A, X );
33       FLA_Trsm_external( FLA_LEFT, FLA_UPPER_TRIANGULAR, FLA_NO_TRANSPOSE,
34                          FLA_NONUNIT_DIAG, FLA_ONE, A, X );
35   }
36 
37   return FLA_SUCCESS;
38 }
39 
40