01: /* ///////////////////////////// P /// L /// A /// S /// M /// A /////////////////////////////// */
02: /* ///                    PLASMA computational routine (version 2.0.0)                       ///
03:  * ///                    Release Date: July, 4th 2009                                       ///
04:  * ///                    PLASMA is a software package provided by Univ. of Tennessee,       ///
05:  * ///                    Univ. of California Berkeley and Univ. of Colorado Denver          /// */
06: 
07: /* /////////////////////////// P /// U /// R /// P /// O /// S /// E /////////////////////////// */
08: // PLASMA_dgeqrs_Tile - Compute a minimum-norm solution min || A*X - B || using the RQ factorization
09: // A = R*Q computed by PLASMA_dgeqrf_Tile.
10: // All matrices are passed through descriptors. All dimensions are taken from the descriptors.
11: 
12: /* ///////////////////// A /// R /// G /// U /// M /// E /// N /// T /// S ///////////////////// */
13: // A        double* (INOUT)
14: //          Details of the QR factorization of the original matrix A as returned by PLASMA_dgeqrf.
15: //
16: // T        double* (IN)
17: //          Auxiliary factorization data, computed by PLASMA_dgeqrf.
18: //
19: // B        double* (INOUT)
20: //          On entry, the m-by-nrhs right hand side matrix B.
21: //          On exit, the n-by-nrhs solution matrix X.
22: 
23: /* ///////////// R /// E /// T /// U /// R /// N /////// V /// A /// L /// U /// E ///////////// */
24: //          = 0: successful exit
25: 
26: /* //////////////////////////////////// C /// O /// D /// E //////////////////////////////////// */
27: #include "common.h"
28: 
29: int PLASMA_dgeqrs_Tile(PLASMA_desc *A, PLASMA_desc *T, PLASMA_desc *B)
30: {
31:     PLASMA_desc descA = *A;
32:     PLASMA_desc descT = *T;
33:     PLASMA_desc descB = *B;
34:     plasma_context_t *plasma;
35: 
36:     plasma = plasma_context_self();
37:     if (plasma == NULL) {
38:         plasma_fatal_error("PLASMA_dgeqrs_Tile", "PLASMA not initialized");
39:         return PLASMA_ERR_NOT_INITIALIZED;
40:     }
41:     /* Check descriptors for correctness */
42:     if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
43:         plasma_error("PLASMA_dgeqrs_Tile", "invalid first descriptor");
44:         return PLASMA_ERR_ILLEGAL_VALUE;
45:     }
46:     if (plasma_desc_check(&descT) != PLASMA_SUCCESS) {
47:         plasma_error("PLASMA_dgeqrs_Tile", "invalid second descriptor");
48:         return PLASMA_ERR_ILLEGAL_VALUE;
49:     }
50:     if (plasma_desc_check(&descB) != PLASMA_SUCCESS) {
51:         plasma_error("PLASMA_dgeqrs_Tile", "invalid third descriptor");
52:         return PLASMA_ERR_ILLEGAL_VALUE;
53:     }
54:     /* Check input arguments */
55:     /* Quick return */
56: /*
57:     if (min(M, min(N, NRHS)) == 0) {
58:         return PLASMA_SUCCESS;
59:     }
60: */
61:     plasma_parallel_call_3(plasma_pdormqr,
62:         PLASMA_desc, descA,
63:         PLASMA_desc, descB,
64:         PLASMA_desc, descT);
65: 
66:     plasma_parallel_call_7(plasma_pdtrsm,
67:         PLASMA_enum, PlasmaLeft,
68:         PLASMA_enum, PlasmaUpper,
69:         PLASMA_enum, PlasmaNoTrans,
70:         PLASMA_enum, PlasmaNonUnit,
71:         double, 1.0,
72:         PLASMA_desc, descA,
73:         PLASMA_desc, descB);
74: 
75:     return PLASMA_SUCCESS;
76: }