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_cunglq_Tile - Generates an M-by-N matrix Q with orthonormal rows, which is defined as the
09: // first M rows of a product of the elementary reflectors returned by PLASMA_cgelqf_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        PLASMA_Complex32_t* (IN)
14: //          Details of the LQ factorization of the original matrix A as returned by PLASMA_cgelqf.
15: //
16: // T        PLASMA_Complex32_t* (IN)
17: //          Auxiliary factorization data, computed by PLASMA_cgelqf.
18: //
19: // B        PLASMA_Complex32_t* (OUT)
20: //          On exit, the M-by-N matrix Q.
21: 
22: /* ///////////// R /// E /// T /// U /// R /// N /////// V /// A /// L /// U /// E ///////////// */
23: //          = 0: successful exit
24: 
25: /* //////////////////////////////////// C /// O /// D /// E //////////////////////////////////// */
26: #include "common.h"
27: 
28: int PLASMA_cunglq_Tile(PLASMA_desc *A, PLASMA_desc *T, PLASMA_desc *B)
29: {
30:     PLASMA_desc descA = *A;
31:     PLASMA_desc descT = *T;
32:     PLASMA_desc descB = *B;
33:     plasma_context_t *plasma;
34: 
35:     plasma = plasma_context_self();
36:     if (plasma == NULL) {
37:         plasma_fatal_error("PLASMA_cunglq_Tile", "PLASMA not initialized");
38:         return PLASMA_ERR_NOT_INITIALIZED;
39:     }
40:     /* Check descriptors for correctness */
41:     if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
42:         plasma_error("PLASMA_cunglq_Tile", "invalid first descriptor");
43:         return PLASMA_ERR_ILLEGAL_VALUE;
44:     }
45:     if (plasma_desc_check(&descT) != PLASMA_SUCCESS) {
46:         plasma_error("PLASMA_cunglq_Tile", "invalid second descriptor");
47:         return PLASMA_ERR_ILLEGAL_VALUE;
48:     }
49:     if (plasma_desc_check(&descB) != PLASMA_SUCCESS) {
50:         plasma_error("PLASMA_cunglq_Tile", "invalid third descriptor");
51:         return PLASMA_ERR_ILLEGAL_VALUE;
52:     }
53:     /* Quick return - currently NOT equivalent to LAPACK's:
54:      * CALL DLASET( 'Full', MAX( M, N ), NRHS, ZERO, ZERO, B, LDB ) */
55: /*
56:     if (min(M, N) == 0)
57:         return PLASMA_SUCCESS;
58: */
59:     plasma_parallel_call_3(plasma_pcunglq,
60:         PLASMA_desc, descA,
61:         PLASMA_desc, descB,
62:         PLASMA_desc, descT);
63: 
64:     return PLASMA_SUCCESS;
65: }