Пример #1
0
lapack_int LAPACKE_zlascl( int matrix_layout, char type, lapack_int kl,
                           lapack_int ku, double cfrom, double cto,
                           lapack_int m, lapack_int n, lapack_complex_double* a,
                           lapack_int lda )
{
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zlascl", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    if( LAPACKE_get_nancheck() ) {
        /* Optionally check input matrices for NaNs */
        switch (type) {
        case 'G':
            if( LAPACKE_zge_nancheck( matrix_layout, m, n, a, lda ) ) {
                return -9;
            }
            break;
        case 'L':
            // TYPE = 'L' - lower triangle of general matrix
            if( matrix_layout == LAPACK_COL_MAJOR &&
                LAPACKE_zgb_nancheck( matrix_layout, m, n, m-1, 0, a, lda+1 ) ) {
                return -9;
            }
            if( matrix_layout == LAPACK_ROW_MAJOR &&
                LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, 0, m-1, a-m+1, lda+1 ) ) {
                return -9;
            }
            break;
        case 'U':
            // TYPE = 'U' - upper triangle of general matrix
            if( matrix_layout == LAPACK_COL_MAJOR &&
                LAPACKE_zgb_nancheck( matrix_layout, m, n, 0, n-1, a-n+1, lda+1 ) ) {
                return -9;
            }
            if( matrix_layout == LAPACK_ROW_MAJOR &&
                LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 0, a, lda+1 ) ) {
                return -9;
            }
            break;
        case 'H':
            // TYPE = 'H' - part of upper Hessenberg matrix in general matrix
            if( matrix_layout == LAPACK_COL_MAJOR &&
                LAPACKE_zgb_nancheck( matrix_layout, m, n, 1, n-1, a-n+1, lda+1 ) ) {
                return -9;
            }
            if( matrix_layout == LAPACK_ROW_MAJOR &&
                LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 1, a-1, lda+1 ) ) {
                return -9;
            }
        case 'B':
            // TYPE = 'B' - lower part of symmetric band matrix (assume m==n)
            if( LAPACKE_zhb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) {
                return -9;
            }
            break;
        case 'Q':
            // TYPE = 'Q' - upper part of symmetric band matrix (assume m==n)
            if( LAPACKE_zhb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
                return -9;
            }
            break;
        case 'Z':
            // TYPE = 'Z' -  band matrix laid out for ?GBTRF
            if( matrix_layout == LAPACK_COL_MAJOR &&
                LAPACKE_zgb_nancheck( matrix_layout, m, n, kl, ku, a+kl, lda ) ) {
                return -9;
            }
            if( matrix_layout == LAPACK_ROW_MAJOR &&
                LAPACKE_zgb_nancheck( matrix_layout, m, n, kl, ku, a+lda*kl, lda ) ) {
                return -9;
            }
            break;
        }
    }
#endif
    return LAPACKE_zlascl_work( matrix_layout, type, kl, ku, cfrom, cto, m,  n, a, lda );
}
Пример #2
0
lapack_int LAPACKE_zlascl( int matrix_layout, char type, lapack_int kl,
                           lapack_int ku, double cfrom, double cto, 
                           lapack_int m, lapack_int n, lapack_complex_double* a, 
                           lapack_int lda )
{
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zlascl", -1 );
        return -1;
    }
#ifndef LAPACK_zISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    switch (type) {
    case 'G':
       if( LAPACKE_zge_nancheck( matrix_layout, lda, n, a, lda ) ) {
           return -9;
           }
        break;
    case 'L':
       // TYPE = 'L' - lower triangular matrix.
       if( LAPACKE_ztr_nancheck( matrix_layout, 'L', 'N', n, a, lda ) ) {
           return -9;
          }
        break;
    case 'U':
       // TYPE = 'U' - upper triangular matrix
       if( LAPACKE_ztr_nancheck( matrix_layout, 'U', 'N', n, a, lda ) ) {
           return -9;
           } 
        break;
    case 'H':
       // TYPE = 'H' - upper Hessenberg matrix   
       if( LAPACKE_zhs_nancheck( matrix_layout, n, a, lda ) ) {
           return -9;
           }    
        break;
    case 'B':
       // TYPE = 'B' - A is a symmetric band matrix with lower bandwidth KL
       //             and upper bandwidth KU and with the only the lower
       //             half stored.   
       if( LAPACKE_zhb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) {
           return -9;
           }
         break;
   case 'Q':
       // TYPE = 'Q' - A is a symmetric band matrix with lower bandwidth KL
       //             and upper bandwidth KU and with the only the upper
       //             half stored.   
       if( LAPACKE_zhb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
           return -9;
           }
        break;
    case 'Z':
       // TYPE = 'Z' -  A is a band matrix with lower bandwidth KL and upper
       //             bandwidth KU. See DGBTRF for storage details.        
       if( LAPACKE_zgb_nancheck( matrix_layout, n, n, kl, kl+ku, a, lda ) ) {
           return -6;
           }
        break;
    }
#endif
    return LAPACKE_zlascl_work( matrix_layout, type, kl, ku, cfrom, cto, m,  n, a, lda );
}