Debian Codegraph @

src/lapack/dec/q/qrutinc/front/flamec/FLASH_QR_UT_inc_solve.c

raw
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
13 FLA_Error FLASH_QR_UT_inc_solve( FLA_Obj A, FLA_Obj TW, FLA_Obj B, FLA_Obj X )
14 {
15 FLA_Obj W, Y;
16 FLA_Obj AT, AB;
17 FLA_Obj YT, YB;
18
19 // Check parameters.
20 if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
21 FLA_QR_UT_inc_solve_check( A, TW, B, X );
22
23 FLASH_Apply_Q_UT_inc_create_workspace( TW, B, &W );
24
25 FLASH_Obj_create_copy_of( FLA_NO_TRANSPOSE, B, &Y );
26
27 FLASH_Apply_Q_UT_inc( FLA_LEFT, FLA_CONJ_TRANSPOSE, FLA_FORWARD, FLA_COLUMNWISE,
28 A, TW, W, Y );
29
30 // Create a temporary hierarchical view of only the top n-by-n part of A in
31 // case m > n so that AT captures the upper triangular factor R. We do the
32 // same for Y to ensure conformality.
33 FLASH_Part_create_2x1( A, &AT,
34 &AB, FLASH_Obj_scalar_width( A ), FLA_TOP );
35 FLASH_Part_create_2x1( Y, &YT,
36 &YB, FLASH_Obj_scalar_width( A ), FLA_TOP );
37
38 FLASH_Trsm( FLA_LEFT, FLA_UPPER_TRIANGULAR, FLA_NO_TRANSPOSE, FLA_NONUNIT_DIAG,
39 FLA_ONE, AT, YT );
40
41 FLASH_Copy( YT, X );
42
43 // Free the temporary hierarchical views.
44 FLASH_Part_free_2x1( &AT,
45 &AB );
46 FLASH_Part_free_2x1( &YT,
47 &YB );
48
49 FLASH_Obj_free( &Y );
50 FLASH_Obj_free( &W );
51
52 return FLA_SUCCESS;
53 }
54