001: /* ///////////////////////////// P /// L /// A /// S /// M /// A /////////////////////////////// */
002: /* ///                    PLASMA computational routine (version 2.0.0)                       ///
003:  * ///                    Release Date: July, 4th 2009                                       ///
004:  * ///                    PLASMA is a software package provided by Univ. of Tennessee,       ///
005:  * ///                    Univ. of California Berkeley and Univ. of Colorado Denver          /// */
006: 
007: /* /////////////////////////// P /// U /// R /// P /// O /// S /// E /////////////////////////// */
008: // PLASMA_ztrsm_Tile - Computes triangular solve A*X = B or X*A = B
009: // All matrices are passed through descriptors. All dimensions are taken from the descriptors.
010: 
011: /* ///////////////////// A /// R /// G /// U /// M /// E /// N /// T /// S ///////////////////// */
012: // side     PLASMA_enum (IN)
013: //          Specifies whether A appears on the left or on the right of X:
014: //          = PlasmaLeft:  A*X = B
015: //          = PlasmaRight: X*A = B
016: //
017: // uplo     PLASMA_enum (IN)
018: //          Specifies whether the matrix A is upper triangular or lower triangular:
019: //          = PlasmaUpper: Upper triangle of A is stored;
020: //          = PlasmaLower: Lower triangle of A is stored.
021: //
022: // transA   PLASMA_enum (IN)
023: //          Specifies whether the matrix A is transposed, not transposed or conjugate transposed:
024: //          = PlasmaNoTrans:   A is transposed;
025: //          = PlasmaTrans:     A is not transposed;
026: //          = PlasmaConjTrans: A is conjugate transposed.
027: //
028: // diag     PLASMA_enum (IN)
029: //          Specifies whether or not A is unit triangular:
030: //          = PlasmaNonUnit: A is non unit;
031: //          = PlasmaUnit:    A us unit.
032: //
033: // A        PLASMA_Complex64_t* (IN)
034: //          The triangular matrix A. If uplo = PlasmaUpper, the leading N-by-N upper triangular
035: //          part of the array A contains the upper triangular matrix, and the strictly lower
036: //          triangular part of A is not referenced. If uplo = PlasmaLower, the leading N-by-N
037: //          lower triangular part of the array A contains the lower triangular matrix, and the
038: //          strictly upper triangular part of A is not referenced. If diag = PlasmaUnit, the
039: //          diagonal elements of A are also not referenced and are assumed to be 1.
040: //
041: // B        PLASMA_Complex64_t* (INOUT)
042: //          On entry, the N-by-NRHS right hand side matrix B.
043: //          On exit, if return value = 0, the N-by-NRHS solution matrix X.
044: 
045: /* ///////////// R /// E /// T /// U /// R /// N /////// V /// A /// L /// U /// E ///////////// */
046: //          = 0: successful exit
047: 
048: /* //////////////////////////////////// C /// O /// D /// E //////////////////////////////////// */
049: #include "common.h"
050: 
051: int PLASMA_ztrsm_Tile(PLASMA_enum side, PLASMA_enum uplo, PLASMA_enum transA, PLASMA_enum diag, PLASMA_desc *A, PLASMA_desc *B)
052: {
053:     PLASMA_desc descA = *A;
054:     PLASMA_desc descB = *B;
055:     plasma_context_t *plasma;
056: 
057:     plasma = plasma_context_self();
058:     if (plasma == NULL) {
059:         plasma_fatal_error("PLASMA_ztrsm_Tile", "PLASMA not initialized");
060:         return PLASMA_ERR_NOT_INITIALIZED;
061:     }
062:     /* Check descriptors for correctness */
063:     if (plasma_desc_check(&descA) != PLASMA_SUCCESS) {
064:         plasma_error("PLASMA_ztrsm_Tile", "invalid first descriptor");
065:         return PLASMA_ERR_ILLEGAL_VALUE;
066:     }
067:     if (plasma_desc_check(&descB) != PLASMA_SUCCESS) {
068:         plasma_error("PLASMA_ztrsm_Tile", "invalid second descriptor");
069:         return PLASMA_ERR_ILLEGAL_VALUE;
070:     }
071:     /* Check input arguments */
072:     if (side != PlasmaLeft && side != PlasmaRight) {
073:         plasma_error("PLASMA_ztrsm_Tile", "illegal value of side");
074:         return -1;
075:     }
076:     if (uplo != PlasmaUpper && uplo != PlasmaLower) {
077:         plasma_error("PLASMA_ztrsm_Tile", "illegal value of uplo");
078:         return -2;
079:     }
080:     if (transA != PlasmaConjTrans && transA != PlasmaNoTrans) {
081:         plasma_error("PLASMA_ztrsm_Tile", "illegal value of transA");
082:         return -3;
083:     }
084:     if (diag != PlasmaUnit && diag != PlasmaNonUnit) {
085:         plasma_error("PLASMA_ztrsm_Tile", "illegal value of diag");
086:         return -4;
087:     }
088:     /* Quick return */
089: /*
090:     if (min(N, NRHS) == 0)
091:         return PLASMA_SUCCESS;
092: */
093:     plasma_parallel_call_7(plasma_pztrsm,
094:         PLASMA_enum, PlasmaLeft,
095:         PLASMA_enum, uplo,
096:         PLASMA_enum, transA,
097:         PLASMA_enum, diag,
098:         PLASMA_Complex64_t, 1.0,
099:         PLASMA_desc, descA,
100:         PLASMA_desc, descB);
101: 
102:     return PLASMA_SUCCESS;
103: }