Пример #1
0
lapack_int LAPACKE_cgtsv( int matrix_layout, lapack_int n, lapack_int nrhs,
                          lapack_complex_float* dl, lapack_complex_float* d,
                          lapack_complex_float* du, lapack_complex_float* b,
                          lapack_int ldb )
{
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_cgtsv", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_cge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) {
        return -7;
    }
    if( LAPACKE_c_nancheck( n, d, 1 ) ) {
        return -5;
    }
    if( LAPACKE_c_nancheck( n-1, dl, 1 ) ) {
        return -4;
    }
    if( LAPACKE_c_nancheck( n-1, du, 1 ) ) {
        return -6;
    }
#endif
    return LAPACKE_cgtsv_work( matrix_layout, n, nrhs, dl, d, du, b, ldb );
}
Пример #2
0
lapack_int LAPACKE_cgttrs( int matrix_layout, char trans, lapack_int n,
                           lapack_int nrhs, const lapack_complex_float* dl,
                           const lapack_complex_float* d,
                           const lapack_complex_float* du,
                           const lapack_complex_float* du2,
                           const lapack_int* ipiv, lapack_complex_float* b,
                           lapack_int ldb )
{
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_cgttrs", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    if( LAPACKE_get_nancheck() ) {
        /* Optionally check input matrices for NaNs */
        if( LAPACKE_cge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) {
            return -10;
        }
        if( LAPACKE_c_nancheck( n, d, 1 ) ) {
            return -6;
        }
        if( LAPACKE_c_nancheck( n-1, dl, 1 ) ) {
            return -5;
        }
        if( LAPACKE_c_nancheck( n-1, du, 1 ) ) {
            return -7;
        }
        if( LAPACKE_c_nancheck( n-2, du2, 1 ) ) {
            return -8;
        }
    }
#endif
    return LAPACKE_cgttrs_work( matrix_layout, trans, n, nrhs, dl, d, du, du2,
                                ipiv, b, ldb );
}
Пример #3
0
lapack_int LAPACKE_claset( int matrix_layout, char uplo, lapack_int m,
                           lapack_int n, lapack_complex_float alpha,
                           lapack_complex_float beta, lapack_complex_float* a,
                           lapack_int lda )
{

    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_claset", -1 );
        return -1;
    }

/*****************************************************************************
*  Note: we do not check NaNs in A since the goal of this subroutine is to
*  initialized A. It is OK if A has NaNs in input.
*****************************************************************************/

#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_c_nancheck( 1, &alpha, 1 ) ) {
        return -5;
    }
    if( LAPACKE_c_nancheck( 1, &beta, 1 ) ) {
        return -6;
    }
#endif

    return LAPACKE_claset_work( matrix_layout, uplo, m, n, alpha, beta, a, lda );
}
Пример #4
0
lapack_logical LAPACKE_cgt_nancheck( lapack_int n,
                                      const lapack_complex_float *dl,
                                      const lapack_complex_float *d,
                                      const lapack_complex_float *du )
{
    return LAPACKE_c_nancheck( n-1, dl, 1 )
        || LAPACKE_c_nancheck( n  , d,  1 )
        || LAPACKE_c_nancheck( n-1, du, 1 );
}
Пример #5
0
lapack_int LAPACKE_cgglse( int matrix_order, lapack_int m, lapack_int n,
                           lapack_int p, lapack_complex_float* a,
                           lapack_int lda, lapack_complex_float* b,
                           lapack_int ldb, lapack_complex_float* c,
                           lapack_complex_float* d, lapack_complex_float* x )
{
    lapack_int info = 0;
    lapack_int lwork = -1;
    lapack_complex_float* work = NULL;
    lapack_complex_float work_query;
    if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_cgglse", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_cge_nancheck( matrix_order, m, n, a, lda ) ) {
        return -5;
    }
    if( LAPACKE_cge_nancheck( matrix_order, p, n, b, ldb ) ) {
        return -7;
    }
    if( LAPACKE_c_nancheck( m, c, 1 ) ) {
        return -9;
    }
    if( LAPACKE_c_nancheck( p, d, 1 ) ) {
        return -10;
    }
#endif
    /* Query optimal working array(s) size */
    info = LAPACKE_cgglse_work( matrix_order, m, n, p, a, lda, b, ldb, c, d, x,
                                &work_query, lwork );
    if( info != 0 ) {
        goto exit_level_0;
    }
    lwork = LAPACK_C2INT( work_query );
    /* Allocate memory for work arrays */
    work = (lapack_complex_float*)
        LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    /* Call middle-level interface */
    info = LAPACKE_cgglse_work( matrix_order, m, n, p, a, lda, b, ldb, c, d, x,
                                work, lwork );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_cgglse", info );
    }
    return info;
}
Пример #6
0
lapack_int LAPACKE_ctfsm( int matrix_layout, char transr, char side, char uplo,
                          char trans, char diag, lapack_int m, lapack_int n,
                          lapack_complex_float alpha,
                          const lapack_complex_float* a,
                          lapack_complex_float* b, lapack_int ldb )
{
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_ctfsm", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( IS_C_NONZERO(alpha) ) {
        if( LAPACKE_ctf_nancheck( matrix_layout, transr, uplo, diag, n, a ) ) {
            return -10;
        }
    }
    if( LAPACKE_c_nancheck( 1, &alpha, 1 ) ) {
        return -9;
    }
    if( IS_C_NONZERO(alpha) ) {
        if( LAPACKE_cge_nancheck( matrix_layout, m, n, b, ldb ) ) {
            return -11;
        }
    }
#endif
    return LAPACKE_ctfsm_work( matrix_layout, transr, side, uplo, trans, diag, m,
                               n, alpha, a, b, ldb );
}
Пример #7
0
lapack_int LAPACKE_cgtcon( char norm, lapack_int n,
                           const lapack_complex_float* dl,
                           const lapack_complex_float* d,
                           const lapack_complex_float* du,
                           const lapack_complex_float* du2,
                           const lapack_int* ipiv, float anorm, float* rcond )
{
    lapack_int info = 0;
    lapack_complex_float* work = NULL;
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_s_nancheck( 1, &anorm, 1 ) ) {
        return -8;
    }
    if( LAPACKE_c_nancheck( n, d, 1 ) ) {
        return -4;
    }
    if( LAPACKE_c_nancheck( n-1, dl, 1 ) ) {
        return -3;
    }
    if( LAPACKE_c_nancheck( n-1, du, 1 ) ) {
        return -5;
    }
    if( LAPACKE_c_nancheck( n-2, du2, 1 ) ) {
        return -6;
    }
#endif
    /* Allocate memory for working array(s) */
    work = (lapack_complex_float*)
        LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,2*n) );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    /* Call middle-level interface */
    info = LAPACKE_cgtcon_work( norm, n, dl, d, du, du2, ipiv, anorm, rcond,
                                work );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_cgtcon", info );
    }
    return info;
}
Пример #8
0
lapack_logical LAPACKE_ctp_nancheck( int matrix_order, char uplo, char diag,
                                      lapack_int n,
                                      const lapack_complex_float *ap )
{
    lapack_int i, len;
    lapack_logical colmaj, upper, unit;

    if( ap == NULL ) return (lapack_logical) 0;

    colmaj = ( matrix_order == LAPACK_COL_MAJOR );
    upper  = LAPACKE_lsame( uplo, 'u' );
    unit   = LAPACKE_lsame( diag, 'u' );

    if( ( !colmaj && ( matrix_order != LAPACK_ROW_MAJOR ) ) ||
        ( !upper  && !LAPACKE_lsame( uplo, 'l' ) ) ||
        ( !unit   && !LAPACKE_lsame( diag, 'n' ) ) ) {
        /* Just exit if any of input parameters are wrong */
        return (lapack_logical) 0;
    }

    if( unit ) {
        /* Unit case, diagonal should be excluded from the check for NaN. */

        /* Since col_major upper and row_major lower are equal,
         * and col_major lower and row_major upper are equals too -
         * using one code for equal cases. XOR( colmaj, upper )
         */
        if( ( colmaj || upper ) && !( colmaj && upper ) ) {
            for( i = 1; i < n; i++ )
                if( LAPACKE_c_nancheck( i, &ap[ ((size_t)i+1)*i/2 ], 1 ) )
                    return (lapack_logical) 1;
        } else {
            for( i = 0; i < n-1; i++ )
                if( LAPACKE_c_nancheck( n-i-1,
                    &ap[ (size_t)i+1 + i*((size_t)2*n-i+1)/2 ], 1 ) )
                    return (lapack_logical) 1;
        }
        return (lapack_logical) 0;
    } else {
        /* Non-unit case - just check whole array for NaNs. */
        len = n*(n+1)/2;
        return LAPACKE_c_nancheck( len, ap, 1 );
    }
}
Пример #9
0
lapack_int LAPACKE_cupmtr( int matrix_order, char side, char uplo, char trans,
                           lapack_int m, lapack_int n,
                           const lapack_complex_float* ap,
                           const lapack_complex_float* tau,
                           lapack_complex_float* c, lapack_int ldc )
{
    lapack_int info = 0;
    /* Additional scalars declarations for work arrays */
    lapack_int lwork;
    lapack_complex_float* work = NULL;
    lapack_int r;
    if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_cupmtr", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    r = LAPACKE_lsame( side, 'l' ) ? m : n;
    if( LAPACKE_cpp_nancheck( r, ap ) ) {
        return -7;
    }
    if( LAPACKE_cge_nancheck( matrix_order, m, n, c, ldc ) ) {
        return -9;
    }
    if( LAPACKE_c_nancheck( m-1, tau, 1 ) ) {
        return -8;
    }
#endif
    /* Additional scalars initializations for work arrays */
    if( LAPACKE_lsame( side, 'l' ) ) {
        lwork = MAX(1,n);
    } else if( LAPACKE_lsame( side, 'r' ) ) {
        lwork = MAX(1,m);
    } else {
        lwork = 1; /* Any value */
    }
    /* Allocate memory for working array(s) */
    work = (lapack_complex_float*)
        LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    /* Call middle-level interface */
    info = LAPACKE_cupmtr_work( matrix_order, side, uplo, trans, m, n, ap, tau,
                                c, ldc, work );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_cupmtr", info );
    }
    return info;
}
Пример #10
0
lapack_int LAPACKE_clacgv( lapack_int n, lapack_complex_float* x,
                           lapack_int incx )
{
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_c_nancheck( 1+(n-1)*ABS(incx), x, incx ) ) {
        return -2;
    }
#endif
    return LAPACKE_clacgv_work( n, x, incx );
}
Пример #11
0
lapack_int LAPACKE_cgttrf( lapack_int n, lapack_complex_float* dl,
                           lapack_complex_float* d, lapack_complex_float* du,
                           lapack_complex_float* du2, lapack_int* ipiv )
{
#ifndef LAPACK_DISABLE_NAN_CHECK
    if( LAPACKE_get_nancheck() ) {
        /* Optionally check input matrices for NaNs */
        if( LAPACKE_c_nancheck( n, d, 1 ) ) {
            return -3;
        }
        if( LAPACKE_c_nancheck( n-1, dl, 1 ) ) {
            return -2;
        }
        if( LAPACKE_c_nancheck( n-1, du, 1 ) ) {
            return -4;
        }
    }
#endif
    return LAPACKE_cgttrf_work( n, dl, d, du, du2, ipiv );
}
Пример #12
0
lapack_int LAPACKE_cunmqr( int matrix_layout, char side, char trans,
                           lapack_int m, lapack_int n, lapack_int k,
                           const lapack_complex_float* a, lapack_int lda,
                           const lapack_complex_float* tau,
                           lapack_complex_float* c, lapack_int ldc )
{
    lapack_int info = 0;
    lapack_int lwork = -1;
    lapack_complex_float* work = NULL;
    lapack_complex_float work_query;
    lapack_int r;
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_cunmqr", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    r = LAPACKE_lsame( side, 'l' ) ? m : n;
    if( LAPACKE_cge_nancheck( matrix_layout, r, k, a, lda ) ) {
        return -7;
    }
    if( LAPACKE_cge_nancheck( matrix_layout, m, n, c, ldc ) ) {
        return -10;
    }
    if( LAPACKE_c_nancheck( k, tau, 1 ) ) {
        return -9;
    }
#endif
    /* Query optimal working array(s) size */
    info = LAPACKE_cunmqr_work( matrix_layout, side, trans, m, n, k, a, lda, tau,
                                c, ldc, &work_query, lwork );
    if( info != 0 ) {
        goto exit_level_0;
    }
    lwork = LAPACK_C2INT( work_query );
    /* Allocate memory for work arrays */
    work = (lapack_complex_float*)
        LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    /* Call middle-level interface */
    info = LAPACKE_cunmqr_work( matrix_layout, side, trans, m, n, k, a, lda, tau,
                                c, ldc, work, lwork );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_cunmqr", info );
    }
    return info;
}
Пример #13
0
lapack_int LAPACKE_claset( int matrix_order, char uplo, lapack_int m,
                           lapack_int n, lapack_complex_float alpha,
                           lapack_complex_float beta, lapack_complex_float* a,
                           lapack_int lda )
{
    if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_claset", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_cge_nancheck( matrix_order, m, n, a, lda ) ) {
        return -7;
    }
    if( LAPACKE_c_nancheck( 1, &alpha, 1 ) ) {
        return -5;
    }
    if( LAPACKE_c_nancheck( 1, &beta, 1 ) ) {
        return -6;
    }
#endif
    return LAPACKE_claset_work( matrix_order, uplo, m, n, alpha, beta, a, lda );
}
Пример #14
0
lapack_int LAPACKE_csyr( int matrix_layout, char uplo, lapack_int n,
                             lapack_complex_float alpha,
                             const lapack_complex_float* x, lapack_int incx,
                             lapack_complex_float* a, lapack_int lda )
{
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_csyr", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_csy_nancheck( matrix_layout, uplo, n, a, lda ) ) {
        return -7;
    }
    if( LAPACKE_c_nancheck( 1, &alpha, 1 ) ) {
        return -4;
    }
    if( LAPACKE_c_nancheck( n, x, 1 ) ) {
        return -5;
    }
#endif
    return LAPACKE_csyr_work( matrix_layout, uplo, n, alpha, x, incx, a,
                                  lda );
}
Пример #15
0
lapack_int LAPACKE_classq( lapack_int n, lapack_complex_float* x,
                           lapack_int incx, float* scale, float* sumsq )
{
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input vector `x` and in/out scalars `scale` and `sumsq` for NaNs */
    if( LAPACKE_c_nancheck( 1+(n-2)*ABS(incx), x, incx ) ) {
        return -2;
    }
    if( LAPACKE_s_nancheck( 1, scale, 1 ) ) {
        return -4;
    }
    if( LAPACKE_s_nancheck( 1, sumsq, 1 ) ) {
        return -5;
    }
#endif
    return LAPACKE_classq_work( n, x, incx, scale, sumsq );
}
Пример #16
0
lapack_int LAPACKE_cungbr( int matrix_order, char vect, lapack_int m,
                           lapack_int n, lapack_int k, lapack_complex_float* a,
                           lapack_int lda, const lapack_complex_float* tau )
{
    lapack_int info = 0;
    lapack_int lwork = -1;
    lapack_complex_float* work = NULL;
    lapack_complex_float work_query;
    if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_cungbr", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_cge_nancheck( matrix_order, m, n, a, lda ) ) {
        return -6;
    }
    if( LAPACKE_c_nancheck( MIN(m,k), tau, 1 ) ) {
        return -8;
    }
#endif
    /* Query optimal working array(s) size */
    info = LAPACKE_cungbr_work( matrix_order, vect, m, n, k, a, lda, tau,
                                &work_query, lwork );
    if( info != 0 ) {
        goto exit_level_0;
    }
    lwork = LAPACK_C2INT( work_query );
    /* Allocate memory for work arrays */
    work = (lapack_complex_float*)
           LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    /* Call middle-level interface */
    info = LAPACKE_cungbr_work( matrix_order, vect, m, n, k, a, lda, tau, work,
                                lwork );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_cungbr", info );
    }
    return info;
}
Пример #17
0
lapack_int LAPACKE_chetrf_rk( int matrix_layout, char uplo, lapack_int n,
                           lapack_complex_float* a, lapack_int lda,
                           lapack_complex_float* e, lapack_int* ipiv )
{
    lapack_int info = 0;
    lapack_int lwork = -1;
    lapack_complex_float* work = NULL;
    lapack_complex_float work_query;
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_chetrf_rk", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_che_nancheck( matrix_layout, uplo, n, a, lda ) ) {
        return -4;
    }
    if( LAPACKE_c_nancheck( n, e, 1 ) ) {
        return -6;
    }
#endif
    /* Query optimal working array(s) size */
    info = LAPACKE_chetrf_rk_work( matrix_layout, uplo, n, a, lda, e, ipiv,
                                &work_query, lwork );
    if( info != 0 ) {
        goto exit_level_0;
    }
    lwork = LAPACK_C2INT( work_query );
    /* Allocate memory for work arrays */
    work = (lapack_complex_float*)
        LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    /* Call middle-level interface */
    info = LAPACKE_chetrf_rk_work( matrix_layout, uplo, n, a, lda, e, ipiv, work,
                                lwork );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_chetrf_rk", info );
    }
    return info;
}
Пример #18
0
lapack_int LAPACKE_cupgtr( int matrix_layout, char uplo, lapack_int n,
                           const lapack_complex_float* ap,
                           const lapack_complex_float* tau,
                           lapack_complex_float* q, lapack_int ldq )
{
    lapack_int info = 0;
    lapack_complex_float* work = NULL;
    if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_cupgtr", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    if( LAPACKE_get_nancheck() ) {
        /* Optionally check input matrices for NaNs */
        if( LAPACKE_cpp_nancheck( n, ap ) ) {
            return -4;
        }
        if( LAPACKE_c_nancheck( n-1, tau, 1 ) ) {
            return -5;
        }
    }
#endif
    /* Allocate memory for working array(s) */
    work = (lapack_complex_float*)
        LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,n-1) );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    /* Call middle-level interface */
    info = LAPACKE_cupgtr_work( matrix_layout, uplo, n, ap, tau, q, ldq, work );
    /* Release memory and exit */
    LAPACKE_free( work );
exit_level_0:
    if( info == LAPACK_WORK_MEMORY_ERROR ) {
        LAPACKE_xerbla( "LAPACKE_cupgtr", info );
    }
    return info;
}
Пример #19
0
lapack_int LAPACKE_cptsvx( int matrix_order, char fact, lapack_int n,
                           lapack_int nrhs, const float* d,
                           const lapack_complex_float* e, float* df,
                           lapack_complex_float* ef,
                           const lapack_complex_float* b, lapack_int ldb,
                           lapack_complex_float* x, lapack_int ldx,
                           float* rcond, float* ferr, float* berr )
{
    lapack_int info = 0;
    float* rwork = NULL;
    lapack_complex_float* work = NULL;
    if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
        LAPACKE_xerbla( "LAPACKE_cptsvx", -1 );
        return -1;
    }
#ifndef LAPACK_DISABLE_NAN_CHECK
    /* Optionally check input matrices for NaNs */
    if( LAPACKE_cge_nancheck( matrix_order, n, nrhs, b, ldb ) ) {
        return -9;
    }
    if( LAPACKE_s_nancheck( n, d, 1 ) ) {
        return -5;
    }
    if( LAPACKE_lsame( fact, 'f' ) ) {
        if( LAPACKE_s_nancheck( n, df, 1 ) ) {
            return -7;
        }
    }
    if( LAPACKE_c_nancheck( n-1, e, 1 ) ) {
        return -6;
    }
    if( LAPACKE_lsame( fact, 'f' ) ) {
        if( LAPACKE_c_nancheck( n-1, ef, 1 ) ) {
            return -8;
        }
    }
#endif
    /* Allocate memory for working array(s) */
    rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,n) );
    if( rwork == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_0;
    }
    work = (lapack_complex_float*)
        LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,n) );
    if( work == NULL ) {
        info = LAPACK_WORK_MEMORY_ERROR;
        goto exit_level_1;
    }
    /* Call middle-level interface */
    info = LAPACKE_cptsvx_work( matrix_order, fact, n, nrhs, d, e, df, ef, b,
                                ldb, x, ldx, rcond, 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_cptsvx", info );
    }
    return info;
}
Пример #20
0
lapack_logical LAPACKE_cpp_nancheck( lapack_int n,
                                      const lapack_complex_float *ap )
{
    lapack_int len = n*(n+1)/2;
    return LAPACKE_c_nancheck( len, ap, 1 );
}