Ejemplo n.º 1
0
lapack_int LAPACKE_zgbrfs( int matrix_order, char trans, lapack_int n,
                           lapack_int kl, lapack_int ku, lapack_int nrhs,
                           const lapack_complex_double* ab, lapack_int ldab,
                           const lapack_complex_double* afb, lapack_int ldafb,
                           const lapack_int* ipiv,
                           const lapack_complex_double* b, lapack_int ldb,
                           lapack_complex_double* x, lapack_int ldx,
                           double* ferr, double* berr )
{
    lapack_int info = 0;
    double* rwork = NULL;
    lapack_complex_double* work = NULL;
    if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zgbrfs", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_zgb_nancheck( matrix_order, n, n, kl, ku, ab, ldab ) ) {
        return -7;
    }
    if( LAPACKE_zgb_nancheck( matrix_order, n, n, kl, kl+ku, afb, ldafb ) ) {
        return -9;
    }
    if( LAPACKE_zge_nancheck( matrix_order, n, nrhs, b, ldb ) ) {
        return -12;
    }
    if( LAPACKE_zge_nancheck( matrix_order, n, nrhs, x, ldx ) ) {
        return -14;
    }
#endif
    /* Allocate memory for working array(s) */
    rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) );
    if( rwork == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    work = (lapack_complex_double*)
        LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,2*n) );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_1;
    }
    /* Call middle-level interface */
    info = LAPACKE_zgbrfs_work( matrix_order, trans, n, kl, ku, nrhs, ab, ldab,
                                afb, ldafb, ipiv, b, ldb, x, ldx, ferr, berr,
                                work, rwork );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_1:
    LAPACKE_free( rwork );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_zgbrfs", info );
    }
    return info;
}
Ejemplo n.º 2
0
lapack_int LAPACKE_zgbbrd( int matrix_layout, char vect, lapack_int m,
                           lapack_int n, lapack_int ncc, lapack_int kl,
                           lapack_int ku, lapack_complex_double* ab,
                           lapack_int ldab, double* d, double* e,
                           lapack_complex_double* q, lapack_int ldq,
                           lapack_complex_double* pt, lapack_int ldpt,
                           lapack_complex_double* c, lapack_int ldc )
{
    lapack_int info = 0;
    double* rwork = NULL;
    lapack_complex_double* work = NULL;
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zgbbrd", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_zgb_nancheck( matrix_layout, m, n, kl, ku, ab, ldab ) ) {
        return -8;
    }
    if( ncc != 0 ) {
        if( LAPACKE_zge_nancheck( matrix_layout, m, ncc, c, ldc ) ) {
            return -16;
        }
    }
#endif
    /* Allocate memory for working array(s) */
    rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,MAX(m,n)) );
    if( rwork == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    work = (lapack_complex_double*)
        LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,MAX(m,n)) );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_1;
    }
    /* Call middle-level interface */
    info = LAPACKE_zgbbrd_work( matrix_layout, vect, m, n, ncc, kl, ku, ab, ldab,
                                d, e, q, ldq, pt, ldpt, c, ldc, work, rwork );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_1:
    LAPACKE_free( rwork );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_zgbbrd", info );
    }
    return info;
}
Ejemplo n.º 3
0
lapack_int LAPACKE_zgbtrf( int matrix_layout, lapack_int m, lapack_int n,
                           lapack_int kl, lapack_int ku,
                           lapack_complex_double* ab, lapack_int ldab,
                           lapack_int* ipiv )
{
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zgbtrf", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_zgb_nancheck( matrix_layout, m, n, kl, kl+ku, ab, ldab ) ) {
        return -6;
    }
#endif
    return LAPACKE_zgbtrf_work( matrix_layout, m, n, kl, ku, ab, ldab, ipiv );
}
Ejemplo n.º 4
0
lapack_int LAPACKE_zgbcon( int matrix_order, char norm, lapack_int n,
                           lapack_int kl, lapack_int ku,
                           const lapack_complex_double* ab, lapack_int ldab,
                           const lapack_int* ipiv, double anorm, double* rcond )
{
    lapack_int info = 0;
    double* rwork = NULL;
    lapack_complex_double* work = NULL;
    if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zgbcon", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_zgb_nancheck( matrix_order, n, n, kl, kl+ku, ab, ldab ) ) {
        return -6;
    }
    if( LAPACKE_d_nancheck( 1, &anorm, 1 ) ) {
        return -9;
    }
#endif
    /* Allocate memory for working array(s) */
    rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,2*n) );
    if( rwork == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    work = (lapack_complex_double*)
        LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,2*n) );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_1;
    }
    /* Call middle-level interface */
    info = LAPACKE_zgbcon_work( matrix_order, norm, n, kl, ku, ab, ldab, ipiv,
                                anorm, rcond, work, rwork );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_1:
    LAPACKE_free( rwork );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_zgbcon", info );
    }
    return info;
}
Ejemplo n.º 5
0
lapack_int LAPACKE_zgbequb( int matrix_order, lapack_int m, lapack_int n,
                            lapack_int kl, lapack_int ku,
                            const lapack_complex_double* ab, lapack_int ldab,
                            double* r, double* c, double* rowcnd,
                            double* colcnd, double* amax )
{
    if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zgbequb", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_zgb_nancheck( matrix_order, m, n, kl, ku, ab, ldab ) ) {
        return -6;
    }
#endif
    return LAPACKE_zgbequb_work( matrix_order, m, n, kl, ku, ab, ldab, r, c,
                                 rowcnd, colcnd, amax );
}
Ejemplo n.º 6
0
lapack_int LAPACKE_zgbsv( int matrix_layout, lapack_int n, lapack_int kl,
                          lapack_int ku, lapack_int nrhs,
                          lapack_complex_double* ab, lapack_int ldab,
                          lapack_int* ipiv, lapack_complex_double* b,
                          lapack_int ldb )
{
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zgbsv", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    if( LAPACKE_get_nancheck() ) {
        /* Optionally check input matrices for NaNs */
        if( LAPACKE_zgb_nancheck( matrix_layout, n, n, kl, kl+ku, ab, ldab ) ) {
            return -6;
        }
        if( LAPACKE_zge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) {
            return -9;
        }
    }
#endif
    return LAPACKE_zgbsv_work( matrix_layout, n, kl, ku, nrhs, ab, ldab, ipiv, b,
                               ldb );
}
Ejemplo n.º 7
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 );
}
lapack_int LAPACKE_zgbsvxx( int matrix_layout, char fact, char trans,
                            lapack_int n, lapack_int kl, lapack_int ku,
                            lapack_int nrhs, lapack_complex_double* ab,
                            lapack_int ldab, lapack_complex_double* afb,
                            lapack_int ldafb, lapack_int* ipiv, char* equed,
                            double* r, double* c, lapack_complex_double* b,
                            lapack_int ldb, lapack_complex_double* x,
                            lapack_int ldx, double* rcond, double* rpvgrw,
                            double* berr, lapack_int n_err_bnds,
                            double* err_bnds_norm, double* err_bnds_comp,
                            lapack_int nparams, double* params )
{
    lapack_int info = 0;
    double* rwork = NULL;
    lapack_complex_double* work = NULL;
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_zgbsvxx", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_zgb_nancheck( matrix_layout, n, n, kl, ku, ab, ldab ) ) {
        return -8;
    }
    if( LAPACKE_lsame( fact, 'f' ) ) {
        if( LAPACKE_zgb_nancheck( matrix_layout, n, n, kl, kl+ku, afb,
            ldafb ) ) {
            return -10;
        }
    }
    if( LAPACKE_zge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) {
        return -16;
    }
    if( LAPACKE_lsame( fact, 'f' ) && ( LAPACKE_lsame( *equed, 'b' ) ||
        LAPACKE_lsame( *equed, 'c' ) ) ) {
        if( LAPACKE_d_nancheck( n, c, 1 ) ) {
            return -15;
        }
    }
    if( nparams>0 ) {
        if( LAPACKE_d_nancheck( nparams, params, 1 ) ) {
            return -27;
        }
    }
    if( LAPACKE_lsame( fact, 'f' ) && ( LAPACKE_lsame( *equed, 'b' ) ||
        LAPACKE_lsame( *equed, 'r' ) ) ) {
        if( LAPACKE_d_nancheck( n, r, 1 ) ) {
            return -14;
        }
    }
#endif
    /* Allocate memory for working array(s) */
    rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,3*n) );
    if( rwork == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    work = (lapack_complex_double*)
        LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,2*n) );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_1;
    }
    /* Call middle-level interface */
    info = LAPACKE_zgbsvxx_work( matrix_layout, fact, trans, n, kl, ku, nrhs, ab,
                                 ldab, afb, ldafb, ipiv, equed, r, c, b, ldb, x,
                                 ldx, rcond, rpvgrw, berr, n_err_bnds,
                                 err_bnds_norm, err_bnds_comp, nparams, params,
                                 work, rwork );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_1:
    LAPACKE_free( rwork );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_zgbsvxx", info );
    }
    return info;
}
Ejemplo n.º 9
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 );
}