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 extern fla_apcaqutinc_t* flash_apcaqutinc_cntl;
14 
FLASH_Apply_CAQ_UT_inc(dim_t p,FLA_Side side,FLA_Trans trans,FLA_Direct direct,FLA_Store storev,FLA_Obj A,FLA_Obj ATW,FLA_Obj R,FLA_Obj RTW,FLA_Obj W,FLA_Obj B)15 FLA_Error FLASH_Apply_CAQ_UT_inc( dim_t p,
16                                   FLA_Side side, FLA_Trans trans, FLA_Direct direct, FLA_Store storev,
17                                   FLA_Obj A, FLA_Obj ATW, FLA_Obj R, FLA_Obj RTW, FLA_Obj W, FLA_Obj B )
18 {
19   FLA_Error r_val;
20   dim_t     nb_part;
21   FLA_Obj   WT, WB;
22 
23   // Check parameters.
24   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
25     FLA_Apply_CAQ_UT_inc_check( side, trans, direct, storev, A, ATW, R, RTW, W, B );
26 
27   // Compute the partition length from the number of partitions.
28   nb_part = FLA_CAQR_UT_inc_compute_blocks_per_part( p, R );
29 
30   // Begin a parallel region.
31   FLASH_Queue_begin();
32 
33   // Apply the individual Q's from the incremental QR factorizations.
34   FLA_Apply_CAQ_UT_inc_apply_panels( nb_part, A, ATW, W, B );
35 
36   FLA_Part_2x1( W,   &WT,
37                      &WB,    1, FLA_TOP );
38 
39   // Apply the Q from the factorization of the upper triangular R's.
40   r_val = FLA_Apply_CAQ_UT_inc_internal( side, trans, direct, storev,
41                                          R, RTW, WT, B, flash_apcaqutinc_cntl );
42 
43 
44   // End the parallel region.
45   FLASH_Queue_end();
46 
47   return r_val;
48 }
49 
50