Ejemplo n.º 1
0
lapack_int LAPACKE_ctfttr_work( int matrix_order, char transr, char uplo,
                                lapack_int n, const lapack_complex_float* arf,
                                lapack_complex_float* a, lapack_int lda )
{
    lapack_int info = 0;
    if( matrix_order == LAPACK_COL_MAJOR ) {
        /* Call LAPACK function and adjust info */
        LAPACK_ctfttr( &transr, &uplo, &n, arf, a, &lda, &info );
        if( info < 0 ) {
            info = info - 1;
        }
    } else if( matrix_order == LAPACK_ROW_MAJOR ) {
        lapack_int lda_t = MAX(1,n);
        lapack_complex_float* a_t = NULL;
        lapack_complex_float* arf_t = NULL;
        /* Check leading dimension(s) */
        if( lda < n ) {
            info = -7;
            LAPACKE_xerbla( "LAPACKE_ctfttr_work", info );
            return info;
        }
        /* Allocate memory for temporary array(s) */
        a_t = (lapack_complex_float*)
            LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
        if( a_t == NULL ) {
            info = LAPACK_TRANSPOSE_MEMORY_ERROR;
            goto exit_level_0;
        }
        arf_t = (lapack_complex_float*)
            LAPACKE_malloc( sizeof(lapack_complex_float) *
                            ( MAX(1,n) * MAX(2,n+1) ) / 2 );
        if( arf_t == NULL ) {
            info = LAPACK_TRANSPOSE_MEMORY_ERROR;
            goto exit_level_1;
        }
        /* Transpose input matrices */
        LAPACKE_cpf_trans( matrix_order, transr, uplo, n, arf, arf_t );
        /* Call LAPACK function and adjust info */
        LAPACK_ctfttr( &transr, &uplo, &n, arf_t, a_t, &lda_t, &info );
        if( info < 0 ) {
            info = info - 1;
        }
        /* Transpose output matrices */
        LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
        /* Release memory and exit */
        LAPACKE_free( arf_t );
exit_level_1:
        LAPACKE_free( a_t );
exit_level_0:
        if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
            LAPACKE_xerbla( "LAPACKE_ctfttr_work", info );
        }
    } else {
        info = -1;
        LAPACKE_xerbla( "LAPACKE_ctfttr_work", info );
    }
    return info;
}
Ejemplo n.º 2
0
lapack_int LAPACKE_cpftrf_work( int matrix_layout, char transr, char uplo,
                                lapack_int n, lapack_complex_float* a )
{
    lapack_int info = 0;
    if( matrix_layout == LAPACK_COL_MAJOR ) {
        /* Call LAPACK function and adjust info */
        LAPACK_cpftrf( &transr, &uplo, &n, a, &info );
        if( info < 0 ) {
            info = info - 1;
        }
    } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
        lapack_complex_float* a_t = NULL;
        /* Allocate memory for temporary array(s) */
        a_t = (lapack_complex_float*)
            LAPACKE_malloc( sizeof(lapack_complex_float) *
                            ( MAX(1,n) * MAX(2,n+1) ) / 2 );
        if( a_t == NULL ) {
            info = LAPACK_TRANSPOSE_MEMORY_ERROR;
            goto exit_level_0;
        }
        /* Transpose input matrices */
        LAPACKE_cpf_trans( matrix_layout, transr, uplo, n, a, a_t );
        /* Call LAPACK function and adjust info */
        LAPACK_cpftrf( &transr, &uplo, &n, a_t, &info );
        if( info < 0 ) {
            info = info - 1;
        }
        /* Transpose output matrices */
        LAPACKE_cpf_trans( LAPACK_COL_MAJOR, transr, uplo, n, a_t, a );
        /* Release memory and exit */
        LAPACKE_free( a_t );
exit_level_0:
        if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
            LAPACKE_xerbla( "LAPACKE_cpftrf_work", info );
        }
    } else {
        info = -1;
        LAPACKE_xerbla( "LAPACKE_cpftrf_work", info );
    }
    return info;
}
Ejemplo n.º 3
0
lapack_int LAPACKE_chfrk_work( int matrix_layout, char transr, char uplo,
                               char trans, lapack_int n, lapack_int k,
                               float alpha, const lapack_complex_float* a,
                               lapack_int lda, float beta,
                               lapack_complex_float* c )
{
    lapack_int info = 0;
    lapack_int na, ka, lda_t;
    lapack_complex_float *a_t = NULL, *c_t = NULL;
    if( matrix_layout == LAPACK_COL_MAJOR ) {
        /* Call LAPACK function and adjust info */
        LAPACK_chfrk( &transr, &uplo, &trans, &n, &k, &alpha, a, &lda, &beta,
                      c );
        if( info < 0 ) {
            info = info - 1;
        }
    } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
        na = LAPACKE_lsame( trans, 'n' ) ? n : k;
        ka = LAPACKE_lsame( trans, 'n' ) ? k : n;
        lda_t = MAX(1,na);
        /* Check leading dimension(s) */
        if( lda < ka ) {
            info = -9;
            LAPACKE_xerbla( "LAPACKE_chfrk_work", info );
            return info;
        }
        /* Allocate memory for temporary array(s) */
        a_t = (lapack_complex_float*)
            LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,ka) );
        if( a_t == NULL ) {
            info = LAPACK_TRANSPOSE_MEMORY_ERROR;
            goto exit_level_0;
        }
        c_t = (lapack_complex_float*)
            LAPACKE_malloc( sizeof(lapack_complex_float) *
                            ( MAX(1,n) * MAX(2,n+1) ) / 2 );
        if( c_t == NULL ) {
            info = LAPACK_TRANSPOSE_MEMORY_ERROR;
            goto exit_level_1;
        }
        /* Transpose input matrices */
        LAPACKE_cge_trans( matrix_layout, na, ka, a, lda, a_t, lda_t );
        LAPACKE_cpf_trans( matrix_layout, transr, uplo, n, c, c_t );
        /* Call LAPACK function and adjust info */
        LAPACK_chfrk( &transr, &uplo, &trans, &n, &k, &alpha, a_t, &lda_t,
                      &beta, c_t );
        info = 0;  /* LAPACK call is ok! */
        /* Transpose output matrices */
        LAPACKE_cpf_trans( LAPACK_COL_MAJOR, transr, uplo, n, c_t, c );
        /* Release memory and exit */
        LAPACKE_free( c_t );
exit_level_1:
        LAPACKE_free( a_t );
exit_level_0:
        if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
            LAPACKE_xerbla( "LAPACKE_chfrk_work", info );
        }
    } else {
        info = -1;
        LAPACKE_xerbla( "LAPACKE_chfrk_work", info );
    }
    return info;
}